This guide covers the 40 most used commands on Ubuntu, categorized into different sections for easier navigation.
- System Information
- File Management
- Directory Navigation
- File Viewing and Editing
- Package Management
- User Management
- Network Management
- Process Management
- Disk Management
- Permission Management
- Compression and Archiving
Displays system information.
uname -aShows or sets the system's hostname.
hostnameShows how long the system has been running.
uptimeDisplays system tasks and resource usage.
topAn improved version of top.
htopDisplays memory usage.
free -hLists directory contents.
ls -lCopies files and directories.
cp source.txt destination.txtMoves or renames files and directories.
mv oldname.txt newname.txtRemoves files or directories.
rm filename.txt
rm -r directory/Creates an empty file or updates the timestamp.
touch newfile.txtChanges the current directory.
cd /path/to/directoryPrints the current working directory.
pwdCreates a new directory.
mkdir new_directoryRemoves an empty directory.
rmdir empty_directoryConcatenates and displays file content.
cat file.txtViews file content one page at a time.
less file.txtViews file content, similar to less.
more file.txtA simple text editor.
nano file.txtA powerful text editor.
vim file.txtInstalls, updates, and removes packages.
sudo apt-get update
sudo apt-get install package_nameSearches for packages.
apt-cache search package_nameManages individual Debian packages.
sudo dpkg -i package.deb
sudo dpkg -r package_nameAdds a new user.
sudo adduser usernameModifies user information.
sudo usermod -aG groupname usernameChanges user password.
passwd usernameDeletes a user.
sudo deluser usernameDisplays or configures network interfaces.
ifconfigTests network connectivity.
ping google.comDisplays network connections, routing tables, and more.
netstat -tulnDownloads files from the internet.
wget http://example.com/file.zipTransfers data from or to a server.
curl http://example.comDisplays currently running processes.
ps auxTerminates a process.
kill process_idTerminates processes by name.
pkill process_nameLists background jobs.
jobsResumes a job in the background.
bg job_idBrings a background job to the foreground.
fg job_idDisplays disk space usage.
df -hDisplays file and directory disk usage.
du -sh /path/to/directoryChanges file permissions.
chmod 755 filename.txtChanges file owner and group.
chown user:group filename.txtArchives files.
tar -cvf archive.tar file1 file2
tar -xvf archive.tarCompresses files.
gzip filename.txt
gunzip filename.txt.gzCompresses files into a ZIP archive.
zip archive.zip file1 file2
unzip archive.zip