Linux-Basic command studyarea-general Linux technology-Linux programming and kernel information. The following is a detailed description. File: There are many types of linux Files that can be viewed using file. For example:
# File/etc
/Etc: directory
# File/etc/rc. d/rc. local
/Etc/rc. d/rc. local: Bourne shell script text executable
# File/bin/ls
/Bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (
Uses shared libs), stripped
# File/dev/fd0
/Dev/fd0: block special (2/0)
Cat: When ls-l is used to view the file and its attributes, the file content is no longer displayed. Therefore, you can use cat to view the file. However, it is best to use file to determine the nature of the file. If you use cat to view binary files, garbled characters may occur. Solution: +... + input reset +. To view binary files, use the od command. You can use + pageup and pagedown to flip pages.
More, less: it is inconvenient to use cat to view long files. If the file content is long, use more or less
More; <enter> flip down a screen with a space. However, you cannot flip the page up.
Less: "enter" and "scroll" scroll down one line, pagedown turning pages, space and scroll up one line, and pageup one page. Finally, the Q key is used to exit.
Head: If you only want to view the first few lines of the file, use head.
The head can only display the first 10 rows of a file. You can add-number to view the number of rows you want to view.
Tac: Since it is cat's reverse writing, its meaning is to look over the content of the file, that is, to see it from the last line.
Sort, then there are only letters and numbers (case-insensitive ). Parameter-n; ignore symbols and letters. They are displayed first and then sorted by values in ascending order. The-r parameter is the opposite of-n.
Find & locate: find the file. Find/-name smb. conf search for the smb. conf file by name under/. The locate command is not long in use under the virtual machine.
Grep: if you forget the file name and only remember one keyword in the file, you can only use grep.
For example: grep kenny/etc/*, the words containing the kenny keyword in/etc will be displayed, followed by the file where the sentence is located. This command is used together with other commands.
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.