Essential Linux Commands for Daily Use
These commands cover all major tasks a Linux user performs daily, including file management, system monitoring, networking, and troubleshooting.
1. File and Directory Management
List files with details, including hidden ones.
ls -la
Change directory.
cd /path/to/directory
Show the current directory path.
pwd
Create a new folder.
mkdir myfolder
Delete a folder and its contents.
rm -rf myfolder
Copy a file to a destination.
cp file1.txt /destination/
Move or rename a file.
mv file1.txt /destination/
Create zip for folder
sudo zip -r zip_file_name.zip /location/file/dir
List of files in folder with date
ls -lt /location/folder/dir
Remove folder with inner data files
sudo rm -rf /location/folder/dir
2. File Viewing and Editing
View file content.
cat file.txt
Edit a file using the Nano editor.
nano file.txt
Edit a file using Vim.
vim file.txt
Show the first 10 lines of a file.
head -n 10 file.txt
Show the last 10 lines of a file.
tail -n 10 file.txt
View a file with scroll support.
less file.txt
3. Disk and Storage Management
Check disk space usage.
df -h
Show the size of a folder.
du -sh /path/foldername
Check Top 10 Largest Files & Folders in a Directory
du -ah /var/lib/docker | sort -rh | head -10
Show all mounted drives.
lsblk
Mount a device.
mount /dev/sdb1 /mnt
Unmount a device.
umount /mnt
4. User and Permission Management
Show the current user.
whoami
Show user ID and group info.
id username
Change file permissions.
chmod 755 file.sh
Change file ownership.
chown user:group file.txt
Create a new user.
sudo useradd newuser
Set a password for a user.
sudo passwd newuser
5. Process and System Monitoring
Check All Running Services
systemctl list-units --type=service --state=running
Check Running Services is is-enabled for machine reboot (auto restart ).
systemctl list-unit-files --type=service | grep enabled
Monitor running processes.
top
Advanced process monitoring (if installed).
htop
Find a running process.
ps aux | grep processname
Kill a process forcefully.
kill -9 PID
Show system uptime.
uptime
Check memory usage.
free -m
Show system performance.
vmstat
6. Networking Commands
Show IP addresses.
ip a
Check network connectivity.
ping google.com
Show open ports.
netstat -tulnp
Get website headers.
curl -I example.com
Download a file.
wget http://example.com/file.zip
7. Package Management
For Debian/Ubuntu:
Update system packages.
sudo apt update && sudo apt upgrade
Install a package.
sudo apt install package-name
Remove a package.
sudo apt remove package-name
For RHEL/CentOS:
Update system packages.
sudo yum update -y
Install a package.
sudo yum install package-name
8. Logs and Troubleshooting
Check system reboots and shutdowns (detect unexpected crashes):
last -x | head -20
Check if any process was recently killed (since last reboot) using dmesg:
dmesg | grep -i 'killed'
dmesg --ctime | grep -i 'killed'
View system logs.
dmesg | tail
Show systemd logs.
journalctl -xe
Check the system logs (last 50 lines)
journalctl -xe --no-pager | tail -50
Find critical errors in the last 7 days:
journalctl -p 3 --since "7 days ago"
Log priority levels
-p 0 (emergencies)
-p 1 (alerts)
-p 2 (critical)
-p 3 (errors)
Monitor system log live.
tail -f /var/log/syslog
Find errors in logs.
grep "error" /var/log/syslog
9. SSH and Remote Access
Connect to a remote server.
ssh user@server-ip
Copy a file to a remote server.
scp file.txt user@server:/path/
Sync files to a remote server.
rsync -avz source/ user@server:/destination/
10. Compression and Archiving
Create a tar archive.
tar -cvf archive.tar folder/
Extract a tar archive.
tar -xvf archive.tar
Create a zip file.
zip -r archive.zip folder/
Extract a zip file.
unzip archive.zip