lsView directory contents and hidden files.ls -lahThe time and size in the list are affected by parameters and system implementation.Copy
cdSwitch the directory where the current terminal is located.cd /path/to/projectThis is a shell built-in command, and quotes are required when the path contains spaces.Copy
headView only the first few lines of the file.head -n 20 app.logIt is suitable to look at the sample first, without reading the entire file at once.Copy
tailLook at the log at the end of the file.tail -n 100 app.logAdded -f to continue following; press Ctrl+C to exit.Copy
lessRead larger text files in pages.less app.logUse / to search and press q to exit without modifying the file.Copy
grepFilter lines in a file by fixed text.grep -nF 'ERROR' app.log-F matches literal text, -n displays line numbers; do not post confidential logs in a public location.Copy
findFind the file name in the specified directory.find ./src -type f -name '*.ts'Wildcard characters are enclosed in quotes to prevent premature expansion by the shell. This example does not delete files.Copy
duView the disk space occupied by the specified directory.du -sh ./dataCounting large directories may be time-consuming, and some files may not have read permissions.Copy
dfCheck the remaining space of the file system.df -hdf checks the file system and du looks at the directory. The statistical calibers of the two are different.Copy
psView the process list.ps -efProcess parameters may contain sensitive information, please check before sharing.Copy
ssView the TCP port that is listening on.ss -ltnThis is a network status tool for Linux and does not automatically scan remote hosts.Copy
ipView the local interface address and routing.ip address show ip route showOnly the current configuration is read; iproute2 may not be installed on the system.Copy
wcCount the number of lines, words, or bytes of text.wc -l notes.txt-l counts the number of newlines. You need to pay attention when there is no newline in the last line.Copy
sort / uniqGroup duplicate rows and count occurrences.sort names.txt | uniq -cSorting depends on the locale; sorting first can merge non-adjacent duplicate rows.Copy
sha256sumComputes the SHA-256 digest of a file.sha256sum archive.zipA summary can check whether the content is consistent, but a summary alone cannot prove that the source of the document is trustworthy.Copy