The importance of the command line to programmers is undeniable, and this article will be updated as it introduces common command lines (Linux and Mac only), as well as command-line tools and learning resources.
Related Network Resources
- Explainshell.com/ the website has a detailed explanation of the command line all instructions, if you have not understand instructions can query to the website.
Command line instruction
I have learned command line instructions for many times, but only memorized several instructions that I often use in the end. Later, I found an effective way to memorize instructions. All instructions are abbreviations of English words, so it is easy to memorize relevant instructions when I know the full name.
- Mkdir (make directory) mkdir Create a directory (folder) mkdir directory1 Create a directory1 directory
- -p –parents create multi-level directory mkdir -p dir1/dir2/dir3
- CD (change directory) CD Switching directory CD dir1 Switch to directory dir1
- Ls (list) ls Displays the files in the current directory
- -l Displays detailed information ls -l
- -a –all Displays all contents including hidden files ls -a
- Rm (remove) rm deletes a file or directory
- -f –force Deletes the file forcibly without prompting rm -f test.txt
- -r, -r, — delete directory and files inside rm -r dir1
- Touch touch Changes the last update time of the file, and creates the file when it does not exist
- Echo echo Create a file and add content echo “Hello” > 1.txt Create 1.txt and fill in “Hello” echo “Hello” >! TXT force create 1. TXT and fill in “Hello” echo “Hello” >> 1. TXT Add “Hello” to 1. TXT
- Cat cat This command is used to print a file or standard input. This command is often used to display file contents, either by concatenating several files, or by reading content from standard input and displaying it. It is often used in conjunction with the redirection symbol. TXT Print the contents in 1. TXT to the screen cat > 1. TXT After entering this command, the contents to be written to 1. TXT are entered on the terminal, and then press Ctrl+D to exit
- -n –number Indicates the line number of the printed content cat-n 1.txt
- TXT dir1/dir3/1. TXT Copy the 1. TXT file in dir1/dir2 to dir/dir3
- -r Replication directory cp dir1/dir2 dir1/dir3 Copies dir2 to dir3
- TXT dir1/dir2/2. TXT Move the 1. TXT to the dir1/dir2 directory and rename it to 2. TXT
- PWD (print printable Directory) PWD Prints the current directory on the screen
- Whoami whoami Prints the current user name
- Man man command name Displays the usage of the command. Man CD Displays the usage of the CD command. Man rm Displays the usage of the rm command
- Wget wget [parameter] [path] Linux and MAC in the download file download tools Detailed instructions explain explainshell.com/explain/1/w… Wget -p -h -e robots=off [url] This command can be used to download all the data of a site
- The curl curl [options] [URL] data transfer tools, used to download or upload data to the server Detailed instructions explain explainshell.com/explain/1/c…
- Tree Tree Displays directories in a tree structure (required for MAC and Windows)… To be continued