Essential Linux Commands: A Quick Reference
Posted on Mar 26, 2025 in Business Sciences
Essential Linux Commands
File and Directory Management
- cd – Change directory. Example:
cd /home/user
(Navigates to the /home/user directory) - mkdir – Create a directory. Example:
mkdir /home/user/new_directory
(Creates a new directory) - ls – List directory contents. Example:
ls /home/user
(Lists files and directories in /home/user) - cp – Copy files. Example:
cp /home/user/file1.txt /home/backup
(Copies file1.txt to /home/backup) - mv – Move files. Example:
mv /home/user/file1.txt /home/new_location
(Moves file1.txt to /home/new_location) - rm – Remove files. Example:
rm /home/user/file1.txt
(Deletes file1.txt)
System Commands
- clear – Clear the terminal screen.
- pwd – Print working directory (shows the current directory).
- chmod – Change file permissions. Example:
chmod 755 /home/user/file1.txt
(Sets permissions) - man – Display manual page for a command. Example:
man pwd
(Shows the manual for the pwd command) - vi – Invoke the vi text editor. Example:
vi /home/user/file1.txt
(Opens file1.txt in vi) - ps – List currently running processes.
- find – Locate files. Example:
find /home/user -type f -name file1.txt
(Finds file1.txt in /home/user) - touch – Update file access/modification times or create a new file. Example:
touch /home/user/file1.txt
- more – Display file content screen by screen. Example:
more /home/user/file1.txt
- cat – Display file content. Example:
cat /home/user/file1.txt
- cal – Display the calendar.
- date – Display the current date and time.
- exit – Exit the shell.
- who – Show who is logged on.
User Management
- addgroup / groupadd – Add a group.
- adduser – Add a user.
- delgroup – Delete a group.
- deluser – Remove a user.
- id – Display user ID information.
- last – Show the last logged-in users.
- login – Change user.
- logout – Log out the current user.
- passwd – Change user password.
- su – Switch user.
- users – List users currently logged in.
- whoami – Display the current user’s username.
Package Management
- apt-cache search – Search for packages.
- apt-get update / install / remove – Update package lists, install, or remove packages.
- dpkg – Install apt packages.
Network Management
- ifconfig – Configure network interfaces.
- ping – Send ICMP echo requests to a network host.
- traceroute – Trace the route packets take to a network host.
Basic Navigation
- / – Root directory.
- . – Current directory.
- .. – Parent directory.
File Operations
- cat – Concatenate files.
- chmod – Change file permissions.
- chown – Change file owner and group.
- cp – Copy files and directories.
- df – Display disk space usage.
- du – Estimate file space usage.
- file – Determine file type.
- find – Search for files in a directory hierarchy.
- gunzip – Uncompress files.
- gzip – Compress files.
- less – View file content (page by page).
- ln – Create hard or symbolic links.
- more – View file content (page by page).
- mv – Move or rename files.
- paste – Merge lines of files.
- rm – Remove files and directories.
- sort – Sort lines of text files.
- tar – Archive files.
- vi or vim – Text editor.