Linux basic operation study notes

1. ctrl plus c usage scenario: inadvertently enter the wrong command, enter other characters without response, use this operation to forcibly terminate the current program
2. View the user command: whoami
3. Return to the previous directory cd ..
4. Return to the home directory cd ~
5. View the current path pwd
6. Create a new folder mkdir and create a new file touch
7. Copy the file to a path cp test.txt /home/hushida/local
8. Delete the file rm move/rename the file mv View the file content cat
9. List files in the current directory ls or list detailed information ls -l
10. View the first 10 lines of the file tail -n -10 /etc/passwd
11. View the file type file
12. Append content symbol >> Overwrite original content>
13. Change the owner of the file iphone6 ​​to hushida sudo chown hushida iphone6
14、zip
package zip something.zip something
Unzip to a path unzip something.zip -D /tmp/ parameter -D means there is a path
15 、 tar
打包 tar -zcvf something.tar something
Unzip to a path tar -zxvf something.tar -C /tmp/

16. Assignment 1: Find the 10 largest occupied files in the current directory
Instructions: sudo du -a / var | sort -n -r | head -n 10
Analysis: du (estimate file space usage) view directory capacity to distinguish df (report file system disk space usage)
sort output after sorting files -n sort by size -r in reverse order
head outputs the first part of the file content

17、删除环境变量: unset PATH 使环境变量立即生效(对zshrc) source .zshrc
18、查找/etc下所有以sh开头的文件 locate /usr/sh
19、查找、/usr/share 下所有jpg文件 locate /usr/share/ \*.jpg
20、在/etc目录下面找名位interfaces的文件或目录 sudo find /etc/ -name interfaces


Guess you like

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