Linux commands for beginners-basic Operations
Linux commands for beginners-basic Operations
Text keywords: Linux, common commands, basic operations
Pwd: show the full path of the current working directory cd: switch the current working directory ls: display directory and file information touch: create or modify file time mkdir: create directory cp: copy files and directories rm: delete files or directories mv: move (rename) files or directories find: search for files or directories du: calculate the space occupied by files or directories 1, pwd
Displays the full path to the current working directory
II. Cd
Switch the current working directory
Usage: cd path cd.: switch to the current directory cd..: switch to the parent directory cd -: return to the previous directory (equivalent to backing) cd [~]: switch to the current user home directory, ~ omit cd / xxx/xxx: switch to a certain path (absolute path writing) cd xxx/xxx: switch to a certain path (relative path writing)
III. Ls
Display directory and file information
Usage: ls [option] [file / directory]-a: display all information, including hidden files and directories (starting with a dot)-d: display information about the directory itself, not information under the directory-h: humanized display (that is, easy to read) capacity information-l: long format display details-c: show the last modification time of the file or directory Use-u: with l to display the last access time of the file or directory, and with l to sort by modification time (sort by file name by default)
IV. Touch
When the file was created or modified
Usage: touch file / directory if the file does not exist, create if the file exists, update the file all time is the current system time
5. Mkdir
Create a directory
Usage: mkdir [options] [directory]-p: create a multi-level directory
VI. Cp
Copy files and directories
Usage: cp [option] Source destination-r: recursive, copy files and subdirectories, generally used when copying directories
7. Rm
Delete a file or directory
Usage: rm [option] file / directory-f: do not prompt, force deletion-I: prompt whether to delete before deletion-r: delete the directory and all the contents under the directory
VIII. Mv
Move a file or directory, or rename it if you move it in the same directory
Usage: mv source target
IX. Find
Search for a file or directory
Usage: find [command options] [path] [expression options]-empty: find blank files or directories-group: find by group-name: find by name-iname: find by name, case-insensitive-mtime: find by modification time-size: find by capacity size-type: find by file type (file: F, directory: d, device: Bambic Link: l)-user: find by user-exec: execute the command on the found file-a: and-o: or
10. Du
Calculate the space occupied by a file or directory
Usage: du [option] [file / directory]-h: humanized (easy to read) display space information-s: display only the total occupied space