Linux Commonly used commands: File and directory management: ls, cd, mkdir, rmdir, rm Text processing: cat, less, grep, sed, awk User and permission management: whoami, passwd, useradd, userdel , chmod system management: top, kill, ps, df, free network management: ping, ifconfig, route, netstat, ssh other common commands: man, history, clear, exit
How to use common Linux commands
1. File and directory management
-
ls : List files and directories in the current directory.
-
cd: Change the current directory.
-
mkdir: Create a directory.
-
rmdir: Delete empty directories.
-
rm: Delete files.
2. Text processing
-
cat: Display the file content.
-
less: Display file contents in pages.
-
grep: Search for text in a file.
-
sed: Replacement text.
-
awk: Process structured text.
3. User and permission management
-
whoami: Display the current user.
-
passwd: Change user password.
-
useradd: Create a user.
-
userdel: Delete the user.
-
chmod: Change file or directory permissions.
4. System Management
-
top: Display system processes and resource usage.
-
kill: Terminate the process.
-
ps: View running processes.
-
df: Display disk space usage.
-
free: Display memory usage.
5. Network Management
-
ping: Test the network connection.
-
ifconfig: Display network interface information.
-
route: Manage network routing tables.
-
netstat: Displays network activity.
-
ssh: Remotely access the system through a secure connection.
6. Other commonly used commands
-
man: Display the help information of the command.
-
history: Display command history.
-
clear: Clear the terminal screen.
-
exit: Exit the shell.
Please follow the correct syntax and options when using these commands. For example:
- To change the current directory, type
cd [directory name]
.
- To search for files containing specific text, type
grep [text][filename]
.
- To delete a file, type
rm [filename]
.
The above is the detailed content of How to use common Linux commands. For more information, please follow other related articles on the PHP Chinese website!