Linux is a powerful operating system that gives users complete control over their computing environment. Whether you're a developer, system administrator, or just curious about the command line, knowing the essential Linux commands is crucial. After working with Ubuntu for the past 20 days, I've compiled a list of 60 commands that every Linux user needs to know. This guide will not only introduce you to these commands but also provide examples to help you understand how to use them effectively.
ls
✅What it does: Lists directory contents.
✅Example: ls -l displays detailed information about files and directories.

mkdir
✅What it does: Creates a new directory.
✅Example: mkdir testing creates a directory named testing.

cd
✅What it does: Changes the current directory.
✅Example: cd testing moves you to the testing directory.

pwd
✅What it does: Prints the current working directory.
✅Example: pwd outputs the full path of the directory you're in.

rm
✅What it does: Removes files or directories.
✅Example: rm file.txt deletes file.txt.

rmdir
✅What it does: Removes empty directories.
✅Example: rmdir empty_folder deletes empty_folder if it's empty.

cp
✅What it does: Copies files or directories.
✅Example: cp file1.txt file2.txt copies file1.txt to file2.txt.mv
✅What it does: Moves or renames files and directories.
✅Example: mv old_name.txt new_name.txt renames the file.

touch
✅What it does: Creates an empty file or updates the timestamp of an existing file.
✅Example: touch newfile.txt creates an empty file named newfile.txt.

cat
✅What it does: Concatenates and displays the content of files.
✅Example:cat file.txtshows the content offile.txt.

more
✅What it does: Views the content of files one page at a time.
✅Example:more file.txtdisplays the file content page by page.less
✅What it does: Similar tomorebut allows backward movement.
✅Example:less file.txtopens the file with the ability to scroll.head
✅What it does: Outputs the first few lines of a file.
✅Example:head -n 10 file.txtshows the first 10 lines offile.txt.tail
✅What it does: Outputs the last few lines of a file.
✅Example:tail -n 10 file.txtshows the last 10 lines offile.txt.echo
✅What it does: Displays a line of text or variables.
✅Example:echo "Hello, World!"prints "Hello, World!" on the terminal.grep
✅What it does: Searches for patterns in files.
✅Example:grep 'search_term' file.txtfindssearch_terminfile.txt.find
✅What it does: Searches for files and directories.
✅Example:find / -name file.txtsearches forfile.txtstarting from the root directory.locate
✅What it does: Quickly searches for files in the database.
✅Example:locate file.txtfindsfile.txtin the file system.chmod
✅What it does: Changes file permissions.
✅Example:chmod 755 script.shsets the permission forscript.sh.chown
✅What it does: Changes file ownership.
✅Example:chown user:group file.txtchanges the owner offile.txt.ps
✅What it does: Displays currently running processes.
✅Example:ps auxshows all running processes.kill
✅What it does: Terminates a process by PID.
✅Example:kill 1234kills the process with PID 1234.top
✅What it does: Displays real-time system processes.
✅Example:topopens the real-time process monitor.htop
✅What it does: An enhanced version oftop.
✅Example:htopgives a more user-friendly view of processes.df
✅What it does: Displays disk space usage.
✅Example:df -hshows disk usage in human-readable format.du
✅What it does: Shows disk usage of files and directories.
✅Example:du -sh *gives the size of each file and directory in the current directory.tar
✅What it does: Archives files.
✅Example:tar -czvf archive.tar.gz /path/to/directorycreates a compressed archive.gzip
✅What it does: Compresses files.
✅Example:gzip file.txtcompressesfile.txtintofile.txt.gz.

gunzip
✅What it does: Decompresses.gzfiles.
✅Example:gunzip file.txt.gzdecompressesfile.txt.gz.

zip
✅What it does: Creates a zip archive.
✅Example:zip archive.zip file1 file2compressesfile1andfile2intoarchive.zip.unzip
✅What it does: Extracts files from a zip archive.
✅Example:unzip archive.zipextracts the contents ofarchive.zip.wget
✅What it does: Downloads files from the internet.
✅Example:wget http://example.com/file.zipdownloadsfile.zip.curl
✅What it does: Transfers data from or to a server.
✅Example:curl -O http://example.com/file.zipdownloadsfile.zip.

ssh
✅What it does: Connects to a remote server via SSH.
✅Example:ssh user@hostconnects to a remote server.

scp
✅What it does: Securely copies files between servers.
✅Example:scp file.txt user@host:/path/to/destinationcopiesfile.txtto a remote server.rsync
✅What it does: Synchronizes files and directories between two locations.
✅Example:rsync -avz /source/ /destination/syncs the source directory to the destination.history
✅What it does: Shows the command history.
✅Example:history | grep 'search_term'finds a command in your history.alias
✅What it does: Creates shortcuts for commands.
✅Example:alias ll='ls -la'creates a shortcut forls -la.unalias
✅What it does: Removes an alias.
✅Example:unalias llremoves thellalias.nano
✅What it does: Opens the nano text editor.
✅Example:nano file.txtopensfile.txtin nano.vim
✅What it does: Opens the vim text editor.
✅Example:vim file.txtopensfile.txtin vim.

apt-get
✅What it does: Installs, upgrades, or removes packages.
✅Example:apt-get install package_nameinstalls a package.


apt
✅What it does: A more user-friendly interface for `apt-get


Conclusion
Linux commands are the building blocks for managing and operating a Linux-based system like Ubuntu. Whether you're a beginner or an experienced user, mastering these essential commands will empower you to navigate, manage, and troubleshoot your system efficiently. From basic file manipulation to advanced process management, these 40+ commands provide a strong foundation to help you unlock the full potential of Linux. As you continue to explore and practice these commands, you'll find that the command line is not just a powerful tool but also an indispensable part of your daily workflow. Keep experimenting, keep learning, and soon these commands will become second nature as you become a more proficient and confident Linux user.
Top comments (2)
If you mention vim, immediately describe how to exit it :)
Well, nano is known, but its style is horrible for many people including me. If I need non-vi-style editor in terminal, I install joe and remove nano.
Let's always list
mcas a sample tool to navigate FS and alleviate one-shot tasks.gunzipis justgzip -d, no need for a separate item.apt-getis Debian style. Equivalents asdnf,yumdeserves listing.May be extended, but if the whole list split into sections.
Nice! With du, you could also use
tree -hswhich will branch all files in a hierarchy and give human readable sizes.