Home>Article>Computer Tutorials> Take stock of some practical Linux tips
Linux is a powerful operating system with many useful commands and tips to help you use it more efficiently.
During the file copying or transmission process, the file may be damaged or modified. In this case, the check value can be used for verification.
Usually, we need to use some interface programs provided by other teams in our work. Whenever the running results of these programs are not as expected, we will compare the md5 check values of both parties to confirm the consistency of the data.
There are many ways to generate the check value of a file. Commonly used ones include md5sum check, crc check, sum check, etc.
Thecommands are:
md5sum file_name cksum file_name sum 算法参数 file_name
For example:
Let’s take a test.txt file as an example:
md5sum test.txt
cksum test.txt
There are two algorithms for sum verification, which we can configure through parameters:
-r: Indicates using the system v algorithm. -s: Indicates using the BSD algorithm.
When we do not configure it, the system v algorithm is used by default.
sum -r test.txt sum -s test.txt
Everyone is usually accustomed to using find to find files, but I think sometimes locate is faster, so I usually use locate first.
locate is different from find: find searches on the hard disk, while locate only searches in the /var/lib/slocate database. The speed of locate is faster than find. It does not really search, but checks the database.
Some systems may not have locate and you need to install it yourself. For example, Ubuntu can be installed by entering the following command:
apt-get update apt-get install mlocate
locateThe command to find files is very simple:
lcoate file_name
The find command can search by name, type, owner, size, etc.
Basic syntax for searching files:
find path -option file_name
If you use the name to search for the stdio.h file:
find / -name stdio.h
We mistakenly entered some relatively long content into the terminal:
it@weijishu:~$ dsfdsfdddddddddddddddddddddddddddddddddddfsgadgdsgasdgsdhfdkshfkjdshflksdhfkldshfkj
How to delete it faster? Frantically pressing the backspace key certainly does the trick. But there is a faster way:
Enter the shortcut key ctrl u to delete all the content in front of the cursor. In addition, there are several practical and commonly used shortcut keys as follows:
In addition, the command line also has many practical and uncommon shortcuts. Interested friends can learn them by themselves.
Order:
pidof process_name
The top command can check some information about the process, but there are too many processes running in the system, which is not conducive to us checking the running status of some processes
At this time we can check the running status of the specified process through the following command, for example:
To view the status of the kcalc process, command:
top -p `pidof kcalc`
This is much simpler.
Notice:
The "` sign" here is not a single quotation mark! ! !
This symbol is to the left of the exclamation point! key on the keyboard.
View multiple processes, such as:
top -p `pidof kcalc` -p `pidof test_x86`
In addition to the above tips, there are also practical tips such as the following. They are briefly listed here and will be introduced in detail later.
The above is the detailed content of Take stock of some practical Linux tips. For more information, please follow other related articles on the PHP Chinese website!