Linux system novice common command introduction

  
                

Learning Linux is actually the process of learning Linux commands, just like learning English is a back word. There are some commands that are very basic. Linux newcomers just need to master these commands when they first contact this system. Xiaobian today collected several common commands that Linux novices have used.

1.pwd command

The command of English interpreted as print working directory (print working directory). Enter the pwd command and Linux will output the current directory.

2.cd command

The cd command is used to change the directory.

cd /Go to the root directory

cd ~ Go to the /home/user user directory

cd /usr Go to the usr directory under the root directory -- -----------Absolute path

cd test Go to the test subdirectory under the current directory ------- Relative path

3.ls command

The ls command is used to view the contents of the directory. Option Meaning -a Lists all files in the directory, including hidden files -l Lists the details in the directory, including permissions, owner, group, size, creation date, whether the file is a link, etc. -f Listed file display file type - r Reverse, from the back to the front of the contents of the directory -R recursion, this option recursively enumerates the contents of all subdirectories in the current directory -s size, sorted by file size -h to display the size of the file in human readable way For example, use K, M, G as the unit ls -l examples.doc to list all the information of the examples.doc file

4.cat command

The cat command can be used to merge files, or Used to display the contents of the entire file on the screen.

cat snow.txt This command displays the contents of the file snow.txt, ctrl+D exits cat.

5.grep Commands

The biggest function of the grep command is to find a specific string in a bunch of files.

grep money test.txt

The above command finds the money string in test.txt, and the grep lookup is case sensitive.

6.touch Command

The touch command is used to create a new file. It can create a blank file where you can add text and data.

touch newfile This command creates a blank file called newfile.

7.cp Command

The cp command is used to copy files. To copy files, enter the command:

cp "source filename" "target filename"

cp t.txt Document/t This command will copy the file t.txt to the Document directory and name it t.

Option Meaning -i Interaction: If the file will overwrite the file in the target, he will prompt to confirm -r recursion: this option will copy the entire directory tree, subdirectories and other -v details: show the copy progress of the file

8.mv Command

The mv command is used to move files.

Option Description -i Interaction: If the selected file will overwrite the file in the target, he will prompt to confirm -f forcing: it will go beyond the interactive mode and move the file without prompting, which is a very dangerous option -v Detail: Display the progress of the file movement

mv t.txt Document Move the file t.txt to the directory Document.

9.rm Command

The rm command is used to delete files.

Option Description -i Interaction: Prompt to confirm deletion -f Force: Instead of interactive mode, do not prompt to confirm deletion -v Details: Show file deletion progress -r Recursion: will delete a directory and all its files And subdirectories

rm t.txt This command deletes the file t.txt

10.rmdir command

The rmdir command is used to delete the directory.

The above are a few commonly used commands for Linux novices. Of course, with the deepening of the Linux system learning, you will also be exposed to more commands. For details, please refer to: Linux Common Commands (including vi/gdb) Operating skills.

Copyright © Windows knowledge All Rights Reserved