Common Commands for Linux
1. File System Navigation:
ls
: List directory contents.cd
: Change the current directory.pwd
: Print the current working directory.mkdir
: Create a new directory.rmdir
: Remove a directory.cp
: Copy files and directories.mv
: Move or rename files/directories.rm
: Remove/delete files and directories.touch
: Create an empty file or update file timestamps.cat
: Concatenate and display file content.head
: Output the start of a file.tail
: Output the end of a file.
2. File Manipulation:
nano
orvi
orvim
: Text editors to create or modify files.grep
: Search for specific patterns in files.find
: Search for files and directories.chmod
: Change file permissions.chown
: Change file ownership.tar
: Archive files.zip
/unzip
: Compress and extract files in ZIP format.gzip
/gunzip
: Compress and decompress files using gzip.
3. System Information
uname
: Display system information.top
orhtop
: Display real-time system processes and their resource usage.df
: Display disk space usage.du
: Display directory space usage.cat /etc/os-release
orcat /proc/version
orcat /etc/*-release
orcat /etc/issue
orcat /var/run/motd
: Viewing the Linux system version
4. Networking:
ping
: Check connectivity to a remote host.ifconfig
orip
: Display and configure network interfaces.ssh
: Securely connect to a remote machine.scp
: Securely copy files between machines.wget
orcurl
: Download files from the internet.
5. Process Management:
ps
: Display information about running processes.kill
: Terminate processes by ID or name.killall
: Terminate processes by name.jobs
: List background jobs.
6. Package Management (for specific package managers):
apt-get
orapt
: Package management on Debian-based systems.yum
ordnf
: Package management on Red Hat-based systems.pacman
: Package management on Arch Linux.
7. User-related:
su -
: Switching to theroot
.su - username
: Switch to another user account.useradd -m newusername
: Create a new user account. (the-m
flag creates the user’s home directory).passwd username
: Set or change a user’s password.userdel username
: Remove a user account.who
: Display who is logged in.
Common Commands for Linux
https://www.hardyhu.cn/2023/10/23/Common-Commands-for-Linux/