1. Ubuntu version number: Cat/etc/issue or lsb_release-a
2. View Ubuntu system bits: Uname-ar or getconf long_bit
3. View the processor architecture of the Ubuntu machine as a result of i686 or X86_64:arch or uname-m
4. Display the current directory contents (catalog list), (if sorted by file change time order, ls-lt available): LS
5. Displays the details of the files in the current directory, including read and write permissions, file size, file generation date, etc.: LL
6. Change the current working directory location, (if you enter the system root, you can directly use the CD/): CD Directory_name, if the folder has a space, you need to enclose the quotation marks, such as enter the directory named a B, the directory is: cd "a B"
7. Delete the specified file in the current directory, such as delete. xxx all files, (for the linked file, just delete the link, the original files are unchanged; If you do not use the-r option, RM does not delete the directory; If you want to remove the confirmation before you delete it, you can use the-I option such as Rm-i XXX): RM *.xxx
8. Delete empty directory, must be empty before a directory is deleted, delete a directory must also have write permission to the parent directory: rmdir xxx
9. Move the file (if the file Xx.yy is moved to the directory TT, MV Xx.yy TT) or rename the file (MV Xx.yy aa.bb If you change the filename xx.yy to AA.BB): MV source file or directory destination file or directory
10. Copy the file (can have multiple files at the same time) or directory to the specified directory (if directory AA is copied to the BB directory: cp-a AA bb): CP source file or source directory destination directory
11. Create a new directory that requires the user who created the directory to have write permissions in the current directory, and that the specified directory name cannot be a directory that is already in the current directory (if you create a directory with permissions of 777, you can mkdir-m 777 filename): mkdir filename
12. View a detailed description of a directive, such as view RM instruction: Man RM
13. Create a static library, such as using all. o files in the current directory to create a libxx.a static library: Ar-r libxx.a *.O
14. Create a dynamic library, such as using all. o files in the current directory to create a libxx.so dynamic library: Gcc-shared–o libxx.so *.O
15. View the current path (full path): pwd
16. Need to prompt permission to execute the command, if you are not the root user, then do some commands to do some of the time is not allowed, at this point can be preceded by the command Sudo:sudo
17. See if the static library contains a function, such as to see if there are fun1 functions in the XX.A static library: NM Xx.a|grep FUN1
18. View CPU Info information: Cat/proc/cpuinfo
19. Display System Date: Date
The CAL command is used to view the Gregorian calendar and can be viewed for a specified year, such as Cal-y 2013, or to view the current month, directly with a CAL, without any parameters.
21. Shut down the system (if not root, add sudo before shutdown): Shutdown-h now
22. Reboot the system (if not root, add sudo before shutdown): Shutdown-r now
23. Shared directory command with Windows, such as shared directory as Test (http://download.csdn.net/detail/jiaoxiaogu/7309181): cd/mnt/hgfs/test
24. Create a soft connection to a file or directory (when we need to use the same file in a different directory, we do not need to put a file that must be the same in every required directory, we just put the file in a fixed directory, and then use the LN command link in the other directory) It does not have to repeat the disk space). Format, ln-s source file destination file. The file keeps changing synchronously. Directories can only create soft links, directory creation links must use absolute path, in the link destination directory to modify the file will be in the source file directory synchronization changes. Create a new directory for the source directory/home/spring/aa/usr/local/aa:ln-s/HOME/SPRING/AA/USR/LOCAL/AA
25. Change the date and time of the file or directory, including access time and change time (if there are two files a.b, C.E, change the date of the C.E file to a.b date, or touch a.b C.E), or create a new nonexistent file (if the existing aa.x file is newly built into a BB. Y file (the Bb.y file is not original) and remains consistent with the contents of the aa.x file, creating the modified time, Touch aa.x bb.y): Touch source filename Destination file name
26. Display the file contents (or cat Aa.txt if the file contents of the Aa.txt are displayed), or connect several files to display: Cat filename
27. Add the output file contents to the line number automatically: NL filename
28. Display the contents of the file as a page by page, press SPACEBAR (space) to display the next page; press the B key to show back page; press the Q key to exit More:more filename
29. Pagination Displays the contents of the file, similar to more, but more powerful than more; press the Q key to exit less; If you search for a string xxx in the file, you can use/xxx to do it; Displays the line number of each line by adding the-n parameter: less parameter filename
30. Used to display the beginning of the file: head filename
31. Used to display the end of the file: tail filename
32. To see if a system command exists or to view the location of an executable file, if the location of the LS command is found, then which LS returns/BIN/LS, and if the command (or the execution file) is not found, no results are returned: which CommandName
33. finds all files in the current directory that have a file name suffix of txt (find / if found from the system root)-name "*.txt"; if you find it from your $home directory, it is find ~ -name "*.txt"; in the/etc directory, find /etc -name "*.txt" To find the file name in the current directory starting with a lowercase letter, and finally 4 to 9 plus. Log end of the file, find . –name "[A-z]*[4-9].log"):find . - name "*.txt"
The
34. chmod command is used to change access rights for Linux system files or directories. Each file and directory in a Linux system has access permissions, which are used to determine who can access and manipulate files and directories. Access to a file or directory is divided into three types: read-only, write-only, and executable. There are three different types of users who can access files or directories, the file owner (typically the creator of the file), the same group of users, and other users. Each file or directory has three groups of access rights, each group is represented by three bits, respectively, the read, write, and execute permissions of the file owner, the read, write, and execute permissions of the user belonging to the primary group, and the read, write, and execute permissions of other users in the system. When you use the ls -l command to display the details of a file or directory, the leftmost column is the file's access rights. The first column has 10 locations, and the first character specifies the file type. In the usual sense, a directory is also a file. If the first character is a horizontal line, it represents a non-directory file. If it is D, the representation is a directory. From the second character to the tenth, a total of 9 characters, a group of 3 characters, respectively, representing 3 groups of users of the file or directory permissions. The permission character is represented by a horizontal line for an empty license, R for Read only, W for write, and X for executable. After determining the access permissions for a file, the user can use the chmod command to reset different access rights. Permission code: r: Read permission, denoted by number 4, W: Write permission, denoted by number 2, x: Execute permission, denoted by number 1;-: delete permission, denoted by number 0; s: special permission. :chmod -r 777 Test
If you add a readable writable executable permission to all files in the catalog test and its subdirectories
35. You can compress, decompress, package, unpack, and so on with the tar command. Packaging refers to a large number of files or directories into a total file, compression is a large file through some compression algorithm into a small file. A package that is called with a tar program is often referred to as a tar package, and the tar package file commands usually end in. Tar. After the tar package is generated, you can use other programs to compress it. Common parameters:-C: To create a new compressed file;-X: Extract files from compressed files;-Z: Support gzip unzip files;-j: Support bzip2 extract files;-Z: Support compress extract files;-V: Displays the operation process;-F: Specifies the compressed file. For example, there is a directory test1, packaging it is: Tar cvf test1.tar test1, if it is packaged and compressed in gzip: tar zcvf est1.tar.gz test1; If unpacking or decompression, then the corresponding CVF and ZCVF replaced with XVF and ZXVF, such as test2.tar.gz decompression, then: Tar xvf est2.tar.gz, the current directory will generate a test2 file.
36. To view the amount of space used by the file or directory disk, you can use the Du command, such as the test directory size, after locating the terminal to the test directory, enter: Du-s
A. diff can compare a single file or directory content. If you specify that the comparison is a file, it is only valid if the input is a text file. Compare the similarities and differences of text files in a row-by-line manner. If you specify a table of contents, the diff command compares a text file with the same name in two directories. Lists the different binaries, common subdirectories, and files that appear only in one directory. such as comparing 1.txt and 2.txt two text files, can be: Diff-c 1.txt 2.txt, will be the content of different places before using "!" Marked out.
The. grep command is a powerful text search tool. If looking for Android keywords from the test.txt file, then: Grep-n ' Android ' Test.txt. You can also find keywords from multiple files at the same time, such as: Grep-n ' Android ' Test1.txt test2.txt
The WC command is used to count the number of lines, words, and bytes in the specified file and display the results of the statistics output. such as: WC Test.txt, the output is 8 9 test.txt, where 8 means the number of rows, 9 is the word count, 10 is the number of bytes, test.txt represents the file name.
The. Free command can display the idle, used physical memory and swap memory in the Linux system, and the buffer used by the kernel. For example: free-m, memory usage is displayed in megabytes.
41. You can use the Apt-get command to install/update a deb package, such as installing g++: Apt-get Install g++
Ubuntu Common Commands Summary