This document is not a Linux/Unix Command manual, but a common method for some commands.
Cat
Concatenate files and print on the standard output.
Usually used to output all the content of a file to the standard output: 'cat file'
Find
Search for files in a directory hierarchy.
Search for files.
E.g. If someone uploads a file with a Chinese name (which may be garbled), how can I delete this file if the unix host does not have a Chinese input method?
Ubuntu 10.4.1 Linux $ LS-I 150220 haha. cubuntu 10.4.1 Linux $ find. -inum 150220-print-exec RM {}\;. /haha. cubuntu 10.4.1 Linux $ find. -inum150220-printubuntu 10.4.1 Linux $ID
Print real and valid tive user and group IDs.
Displays the user's userid and groupid. The current user is displayed by default.
The running results of various platforms are as follows:
ubuntu 10.4.1 linux $ id uid=1000(mjn) gid=1000(mjn) groups=4(adm),20(dialout), 24(cdrom),46(plugdev),105(lpadmin),119(admin),122(sambashare),1000(mjn)suse 11 linux $ id uid=1000(mjn) gid=1000(mjn) groups=4(adm)redhat 6.2 linux $ id uid=1000(mjn) gid=1000(mjn) groups=4(adm)aix 6.1 unix $ id uid=1000(mjn) gid=1000(mjn) groups=4(adm)sunos 5.10 unix $ id uid=1000(mjn) gid=1000(mjn)
Info
Read info documents.
Compared with man, info information is more detailed. info information is displayed in the format of texinfo.
Ls
List directory contents.
'-I': displays the index number of the file (each file is unique ).
'-L': the first line is similar to 'total 64'. 64 indicates the space occupied by all files in the directory, in KB.
'-H': displays the object size in a user-friendly manner, such as 'total 64k'. If the size is smaller than 1 kb, the unit is not displayed.
E.g. 'LS-LRT ', sorted by modification time, and detailed information is displayed in reverse order. this command is useful when there are many files and you want to see the recently modified files (such as the files that have just been written to the log directory.
ubuntu 10.4.1 linux $ ls -lrth total 64K drwxr-xr-x 2 mjn mjn 4.0K 2013-03-27 20:11 make -rw-r--r-- 1 mjn mjn 1.5K 2013-03-27 20:25 sockserver.c -rw-r--r-- 1 mjn mjn 867 2013-05-23 22:26 main.c -rw-r--r-- 1 mjn mjn 63 2013-05-23 22:28 msq.log
'-1' (number 1): displays a file name in each row. the results can be further processed using pipelines as input by other programs. the following command shows the number of files in the current directory (in the Command 'LS-1 | WC-l', the first '-1' is the number 1, the second '-L' is the letter L ):
ubuntu 10.4.1 linux $ ls -1 | wc -l 15
Man
An interface to the on-line reference manuals.
View the help of a function or shell command.
PS
Report a snapshot of the current processes.
Displays the currently running process.
'-U'. The parameter is the user name or userid.
The following shows the processes that the current user is running:
ubuntu 10.4.1 linux $ ps -u `whoami` 2167 pts/1 00:00:00 bash 2283 pts/1 00:00:00 pager 2292 pts/0 00:00:00 ps
Nohup
Run a command immune to hangups, with output to a non-tty.
Append the standard output of the command to the 'nohup. the end of 'out' (the file is in the current directory or $ home directory), or output to the file through 'nohup command> file. if the file 'nohup. if 'out' does not exist, it is automatically created.
ubuntu 10.4.1 linux $ nohup ls -m nohup: ignoring input and appending output to `nohup.out'ubuntu 10.4.1 linux $ cat nohup.out backup, bin, codes, Desktop
Use the 'nohup Program & 'command to make the program 'program' Run quietly in the background.
Tail
Output the last part of files.
'-F' to dynamically display the content added to the end of the file. It can be used to view the log file being written. Use 'ctl + C' to force exit.
ubuntu 10.4.1 linux $ tail -f msq.log thread msqread start
Uname
Print system information.
'-S', default parameter, output system name, usually used in shell scripts to determine the type of the system to determine which compiler to use.
ubuntu 10.4.1 linux $ uname Linuxsuse 11 linux $ name Linuxredhat 6.2 linux $ name Linuxaix 6.1 unix $ uname AIXsunos 5.10 unix $ uname SunOS
For details, refer to another article:
View the number of CPU and system kernel digits.
WC
Print newline, word, and byte counts for each file.
Displays the number of lines, words, and characters in the file.
(To calculate the number of files in the current directory, see the 'LS' command in this article)
ubuntu 10.4.1 linux $ cat file.txtA very intelligent turtleFound programming UNIX a hurdle The system, you see, Run as slow as did he,And that's not saying much for the turtle.ubuntu 10.4.1 linux $ wc file.txt 5 27 153 file.txt
Whatis
Display manual page descriptions.
A brief description of the command is displayed.
ubuntu 10.4.1 linux $ whatis who who (1) - show who is logged on
Which
Locate a command.
A brief description of the command is displayed.
ubuntu 10.4.1 linux $ which who /usr/bin/who
Who
Show who is logged on.
Combined with grep, the current user's logon IP address can be displayed (multiple users may use the same user name to log on ).
ubuntu 10.4.1 linux $ who | grep `whoami` mjn tty7 2013-05-23 22:22 (:0) mjn pts/0 2013-05-23 22:22 (:0.0)
Whoami
Print valid userid.
Show the current 'Who Am out'
ubuntu 10.4.1 linux $ whoami mjn
References:
The Linux Information Project