The Linux operating system offers a powerful array of commands to manage files, navigate directories, control processes, and interact with the system. This diverse toolkit empowers users to manipulate their environment efficiently. Commands like ls
, cd
, and pwd
facilitate directory navigation, while cp
and mv
allow for copying and moving files. To manage processes, ps
, top
, and kill
provide insight and control. System information is available through commands like uname
and free
. The system’s network capabilities are harnessed by commands such as ping
, ssh
, and netstat
. Additionally, administrative tasks are supported by commands like useradd
, chown
, and shutdown
. Overall, these commands exemplify Linux’s flexibility and functionality.
Command | Syntax | Description | Example |
---|---|---|---|
ls | ls [options] [directory] | List files and directories | ls -l /home/user/documents |
cd | cd [directory] | Change the current directory | cd /var/www/html |
pwd | pwd | Print the current working directory | pwd |
cp | cp [options] source destination | Copy files or directories | cp file.txt /backup/ |
mv | mv [options] source destination | Move or rename files or directories | mv oldfile.txt newfile.txt |
rm | rm [options] file/directory | Remove files or directories | rm -rf folder/ |
mkdir | mkdir [options] directory | Create a new directory | mkdir new_folder |
rmdir | rmdir directory | Remove an empty directory | rmdir empty_folder |
touch | touch filename | Create an empty file | touch newfile.txt |
cat | cat filename | Display the contents of a file | cat myfile.txt |
echo | echo [options] message | Print a message or value to terminal | echo “Hello, world!” |
grep | grep [options] pattern file | Search for patterns in files | grep “error” logfile.txt |
chmod | chmod [options] permissions file | Change file permissions | chmod 755 script.sh |
chown | chown [options] user:group file | Change file ownership | chown user:group myfile.txt |
ps | ps [options] | Display information about processes | ps aux |
top | top | Display dynamic list of processes | top |
kill | kill [options] process_id | Terminate a process | kill 1234 |
df | df [options] | Display disk space usage | df -h |
du | du [options] directory/file | Display file/directory space usage | du -sh /path |
free | free [options] | Display memory usage | free -h |
uname | uname [options] | Print system information | uname -a |
date | date [options] | Display or set system date and time | date |
cal | cal [options] | Display calendar | cal |
who | who [options] | Display logged-in users | who |
w | w | Display information about users | w |
id | id [options] username | Display user and group information | id john |
history | history [options] | Display command history | history |
clear | clear | Clear the terminal screen | clear |
man | man command | Display manual page for command | man ls |
info | info command | Display info page for command | info ls |
alias | alias [options] | Create or display command aliases | alias ll=’ls -l’ |
file | file filename | Determine file type | file myfile.txt |
tar | tar [options] | Archive and extract files | tar -cvf archive.tar files |
zip | zip [options] archive files | Create compressed archive | zip archive.zip file1.txt file2.txt |
unzip | unzip [options] archive | Extract files from compressed archive | unzip archive.zip |
ssh | ssh [options] user@host | Connect to remote host using SSH | ssh [email protected] |
scp | scp [options] source destination | Copy files securely over SSH | scp file.txt [email protected]:/path/ |
rsync | rsync [options] source destination | Sync files and directories | rsync -avz source/ destination/ |
wget | wget [options] URL | Download files from the web | wget https://example.com/file.txt |
curl | curl [options] URL | Transfer data to/from URLs | curl -O https://example.com/file.txt |
ping | ping [options] host | Test network connectivity | ping google.com |
ifconfig | ifconfig [options] | Configure network interfaces | ifconfig |
ip | ip [options] | Manage network interfaces | ip addr show |
route | route [options] | Display or manipulate routing table | route -n |
netstat | netstat [options] | Network statistics | netstat -tuln |
nslookup | nslookup domain | DNS lookup | nslookup google.com |
dig | dig domain | DNS lookup (more advanced) | dig google.com |
traceroute | traceroute host | Display route and delay to host | traceroute google.com |
whois | whois domain | Get domain registration info | whois example.com |
uptime | uptime | Display system uptime | uptime |
shutdown | shutdown [options] | Shutdown or restart system | shutdown -h now |
reboot | reboot | Reboot the system | reboot |
ifup | ifup interface | Bring a network interface up | ifup eth0 |
ifdown | ifdown interface | Take a network interface down | ifdown eth0 |
systemctl | systemctl [options] command service | Manage systemd services | systemctl start apache2 |
service | service [options] command service | Control system services | service apache2 start |
useradd | useradd [options] username | Create a new user | useradd john |
userdel | userdel [options] username | Delete a user | userdel john |
passwd | passwd [options] username | Change user password | passwd john |
groupadd | groupadd [options] groupname | Create a new group | groupadd developers |
groupdel | groupdel [options] groupname | Delete a group | groupdel developers |
su | su [options] username | Switch user | su john |
sudo | sudo command | Execute command with superuser privileges | sudo apt update |
adduser | adduser username | Add a user interactively | adduser sarah |
deluser | deluser username | Delete a user and associated files | deluser sarah |
passwd | passwd username | Change user password | passwd sarah |
addgroup | addgroup groupname | Add a group | addgroup team1 |
delgroup | delgroup groupname | Delete a group | delgroup team1 |
chmod | chmod [options] permissions file | Change file permissions | chmod 644 myfile.txt |
chown | chown [options] user:group file | Change file ownership | chown user:group myfile.txt |
find | find [options] path expression | Search for files and directories | find /var/log -name “*.log” |
locate | locate keyword | Search for files using an index | locate myfile.txt |
ln | ln [options] source link | Create symbolic or hard links | ln -s target link |
mount | mount [options] device mountpoint | Mount a filesystem | mount /dev/sdb1 /mnt |
umount | umount [options] mountpoint | Unmount a filesystem | umount /mnt |
df | df [options] | Display disk space usage | df -h |
du | du [options] directory/file | Display file/directory space usage | du -sh /path |
free | free [options] | Display memory usage | free -h |
uname | uname [options] | Print system information | uname -a |
date | date [options] | Display or set system date and time | date |
cal | cal [options] | Display calendar | cal |
who | who [options] | Display logged-in users | who |
w | w | Display information about users | w |
id | id [options] username | Display user and group information | id john |
history | history [options] | Display command history | history |
clear | clear | Clear the terminal screen | clear |
man | man command | Display manual page for command | man ls |
info | info command | Display info page for command | info ls |