Some commands and techniques in linux

Source: Internet
Author: User

Some commands and tips in linux 1. ctrl + Alt + F1 can be quickly switched to the command line, Ctrl + Alt + F8 and then switched back to the GUI 2. sb_release-a can view the information of the current linux release, getconf LONG_BIT, view the number of operating system digits, top view CPU usage 3. lsof: list all open files. For example, 'lsof-p 100' lists all open files of process 456,123 and 456. 'Lsof-I 6' lists all IPv6 network files. 4. nl: add the row number to each output line. For example: 'cat 1.txt | nl', output the 1.txt file and add the row number 5. CTRL + a and CTRL + e: to the beginning of the command line (ctrl + a) and the end of the line (ctrl + e), especially useful on the keyboard, do not bother finding the HOME and END keys 6.ALT+.: list the last parameter of the previous command. This command is the most commonly used. For example, 'mkdir mydir' and 'CD ALT + .'. Very easy to use 7. CTRL + R: this is also very common, and the search command history is quite convenient. 8. grep/sed/cut/tr/: the combination of these commands can easily parse many files, so we will not give an example one by one. The awk is not commonly used by individuals. I think 'sed 'is enough. 9. find/xargs: this is also very common. find a specific string in a bunch of files. This is often used in combination with the LIST commands in 8. 10. ls-d */: This command only lists all the first-level subdirectories in the current directory, excluding '. 'hide directories. To list Hidden Directories, use 'LS-d. *'. 'Find-type d-maxdepth 1' has a similar effect. 11. id: list all user groups to which the user belongs. 12. Brace Expansion: ls/usr/{, local}/bin "to list all files under"/usr/bin "and"/usr/local/bin. This mechanism is called "Brace Expansion". For another example, "diff. bashrc {,. backup}" shows the differences between. bashrc and. bashrc. backup files. 13. column: A common syntax is 'mount | column-t', or 'df | column-t', making the output easier to read. 14. ssh/sshfs/scp: Use ssh-related tools to make remote work easier. 'Ssh-x' enables the X-forward function. 'Ssh-keygen 'and 'ssh-copy-id' save you the trouble of entering a password each time. Ssh root@10.1.1.1 "Remote Command" lets your command be executed remotely. 'Sshfs root@10.1.1.1:/var // home/root/var' mount the remote directory directly to the local directory. "Scp root@10.1.1.1:. vimrc." copy the. vimrc file in the root user HOME directory on the remote server to your local machine. 15. use '<' to read the file to the standard input. For all commands that accept the standard input, use '<file name' to send a file to the standard input, it can also appear anywhere in the command. For example, the effects of the three commands above "cat filename" "<filename cat" "cat <filename" are identical.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.