Ubuntu, one of the most popular distributions of the Linux operating system, is renowned for its user-friendliness and robustness. Whether you’re a seasoned Linux expert or a newcomer to the world of open-source software, mastering essential commands can significantly enhance your productivity and streamline your work. Below is a collection of over 50 Ubuntu Linux commands that every user should know, structured for easy navigation and understanding.
Table of Contents
1. Basic Ubuntu Linux Commands
1.1 ls
Lists files and directories in the current directory.
ls
1.2 cd
Changes the current directory.
cd /path/to/directory
1.3 pwd
Prints the current working directory.
pwd
1.4 mkdir
Creates a new directory.
mkdir new_directory
1.5 rmdir
Removes an empty directory.
rmdir empty_directory
1.6 rm
Removes files or directories.
rm file.txt
rm -r directory_name # Use -r to delete directories recursively
1.7 cp
Copies files or directories.
cp source.txt destination.txt
cp -r source_directory destination_directory # Copy directories
1.8 mv
Moves or renames files or directories.
mv old_name.txt new_name.txt
2. File Operations Linux Commands
2.1 cat
Concatenates and displays file content.
cat file.txt
2.2 more
Views file content page by page.
more file.txt
2.3 less
Similar to more
, but allows backward and forward navigation.
less file.txt
2.4 head
Displays the first ten lines of a file.
head file.txt
2.5 tail
Displays the last ten lines of a file.
tail file.txt
2.6 find
Searches for files and directories.
find /path/to/search -name filename.txt
2.7 grep
Searches for patterns within files.
grep 'search_term' file.txt
2.8 wc
Counts lines, words, and characters in a file.
wc file.txt
3. System Information Linux Commands
3.1 uname
Displays system information.
uname -a
3.2 df
Shows disk space usage.
df -h # -h for human-readable format
3.3 du
Displays directory space usage.
du -sh directory_name # -s for summary and -h for human-readable
3.4 top
Displays real-time system processes and resource usage.
top
3.5 htop
An interactive process viewer (install with sudo apt install htop
).
htop
3.6 free
Shows memory usage.
free -h
3.7 uptime
Displays how long the system has been running.
uptime
4. Package Management Commands
4.1 apt update
Updates the package index.
sudo apt update
4.2 apt upgrade
Upgrades all installed packages to their latest versions.
sudo apt upgrade
4.3 apt install
Installs a new package.
sudo apt install package_name
4.4 apt remove
Removes a package.
sudo apt remove package_name
4.5 apt search
Searches for a package.
apt search package_name
4.6 apt list
Lists installed packages or available packages.
apt list --installed
5. Networking Linux Ubuntu Commands
5.1 ping
Checks connectivity to a host.
ping google.com
5.2 ifconfig
Displays network interface configuration (use ip addr
in newer systems).
ifconfig
5.3 ip
A powerful command for managing network interfaces.
ip addr show # Displays IP addresses and status
5.4 netstat
Displays network connections.
netstat -tuln # Shows TCP and UDP ports in use
5.5 curl
Transfers data from or to a server using various protocols.
curl http://example.com
5.6 wget
Downloads files from the web.
wget http://example.com/file.zip
6. User and Permissions Management
6.1 whoami
Displays the current username.
whoami
6.2 adduser
Adds a new user.
sudo adduser new_username
6.3 deluser
Deletes a user.
sudo deluser username
6.4 chmod
Changes file permissions.
chmod 755 file.txt
6.5 chown
Changes file owner and group.
chown user:group file.txt
7. Disk Management Commands
7.1 mount
Mounts a filesystem.
sudo mount /dev/sdb1 /mnt/usb
7.2 umount
Unmounts a filesystem.
sudo umount /mnt/usb
7.3 fdisk
Partitions disks.
sudo fdisk -l # Lists all partitions
7.4 fsck
Checks and repairs a Linux filesystem.
sudo fsck /dev/sdb1
8. System Control Commands
8.1 shutdown
Shuts down the system.
sudo shutdown now
8.2 reboot
Reboots the system.
sudo reboot
8.3 systemctl
Controls systemd services and the system state.
sudo systemctl start service_name
sudo systemctl stop service_name
8.4 journalctl
Views system logs.
journalctl -u service_name # Logs for a specific service
9. Text Processing
9.1 sort
Sorts lines of text files.
sort file.txt
9.2 uniq
Removes duplicate lines from sorted files.
sort file.txt | uniq
9.3 cut
Cuts sections from each line of files.
cut -d' ' -f1 file.txt # Delimiter is a space; get the first column
9.4 paste
Merges lines of files.
paste file1.txt file2.txt
Conclusion
All of the above commands can be used on remote linux dedicated server or linux vps and at first these Ubuntu command line may seem daunting at first, but familiarizing yourself with these essential commands can reward you with greater control over your system and a more productive workflow. This overview of over 50 commands serves as a foundational guide to exploring the powerful capabilities of Ubuntu Linux.
As you delve deeper into Linux, remember that practice and experimentation are key. Use these commands as starting points to uncover more advanced functionalities, helping you become a more proficient Ubuntu user. Embrace the open-source community and enjoy the journey of mastering Linux!