Linux study notes - file processing commands

1. touch command

touch --- create filename

touch [file name]: (in the root directory is to directly write the root directory, if it is not created in the root directory, write the absolute path of the detailed directory name)

touch test01 test02 : create two filenames at the same time

touch 'test test': Create a file name with spaces (it is not recommended to create a file name with spaces, and you need to query with spaces in subsequent queries, which is a bit troublesome)

2. cat command

cat --- display file contents

cat -n(number, line number) : Add the line number to view the file content of the specific file line number

3. tac command

tac --- Display file contents in reverse

4. The more command

more ---- Pagination to display the contents of the file

After entering: press space or f to reverse the page; enter to newline; Q or q to exit

5. The less command

less --- Paginate the contents of the file (the page can be reversed upwards)

After entering, press the up arrow to reverse the page; /[Search content] press Enter to find the specific content

6. head command

head --- Display the content of the first few lines (the first 10 lines are displayed by default)

head -n (specific line number): Display the specific line of the file

7. tail command

tail --- Display the last few lines of the file

tail -n : display the specified line

tail -f : Dynamically display the content at the end of the file

Press: ctrl c : exit


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326394535&siteId=291194637