Embarking on your journey with Linux, especially with a distribution like Ubuntu, introduces you to a powerful command-line interface (CLI) that can significantly enhance your productivity and understanding of the system. Here's a curated list of essential Linux commands, including both built-in and installable ones, that are invaluable to learn in your first two weeks. This list covers file management, system information, networking, and package management, providing a solid foundation for beginners.
File and Directory Management
ls(list directory contents)- Example:
ls -l /home(lists files in /home with detailed information)
- Example:
cd(change directory)- Example:
cd /var/www(changes the current directory to /var/www)
- Example:
mkdir(make directory)- Example:
mkdir new_folder(creates a new directory named new_folder)
- Example:
rmdir(remove directory)- Example:
rmdir old_folder(removes the directory named old_folder)
- Example:
touch(create a blank file)- Example:
touch example.txt(creates a blank file named example.txt)
- Example:
rm(remove files or directories)- Example:
rm unwanted.txt(removes the file named unwanted.txt)
- Example:
cp(copy files or directories)- Example:
cp source.txt destination.txt(copies source.txt to destination.txt)
- Example:
mv(move or rename files or directories)- Example:
mv oldname.txt newname.txt(renames or moves a file)
- Example:
System Information and Management
top(display active processes)- Example:
top(shows a dynamic view of running processes)
- Example:
htop(interactive process viewer, may require installation)- Example:
htop(provides a detailed overview of system processes)
- Example:
df(report file system disk space usage)- Example:
df -h(displays disk space in a human-readable format)
- Example:
free(display memory usage)- Example:
free -m(shows the amount of free and used memory in megabytes)
- Example:
uname(show system information)- Example:
uname -a(displays all system information)
- Example:
Networking
ping(check the network connection to a server)- Example:
ping google.com(checks connectivity to google.com)
- Example:
ifconfig(configure network interfaces, may require installation)- Example:
ifconfig(displays network interfaces and IP addresses)
- Example:
netstat(network statistics)- Example:
netstat -tuln(lists all tcp and udp ports listening for connections)
- Example:
wget(retrieve files from the web)- Example:
wget http://example.com/file.zip(downloads file.zip from example.com)
- Example:
Package Management (Ubuntu/Debian)
apt-get(package handling utility)- Example:
sudo apt-get update(updates package lists for upgrades) - Example:
sudo apt-get install htop(installs the htop package)
- Example:
dpkg(Debian package management system)- Example:
dpkg -l(lists all installed packages)
- Example:
Text File Viewing and Editing
cat(concatenate files and print on the standard output)- Example:
cat file.txt(displays the content of file.txt)
- Example:
nano(easy-to-use text editor)- Example:
nano file.txt(opens file.txt in nano for editing)
- Example:
grep(search text using patterns)- Example:
grep "search term" file.txt(searches for "search term" within file.txt)
- Example:
Miscellaneous
chmod(change file mode bits)- Example:
chmod +x script.sh(makes script.sh executable)
- Example:
man(manual pages for commands)- Example:
man ls(displays the manual page for the ls command)
- Example:
echo(display a line of text)- Example:
echo "Hello, World!"(prints Hello, World! to the terminal)
- Example:
Learning these commands provides a strong foundation for navigating and managing your Linux environment efficiently. Practice regularly and refer to the man pages for more detailed information and options available for each command.