Command line, also known as the terminal or shell, is a powerful tool for interacting with a computer’s operating system. It allows users to execute commands and perform tasks without the need for a graphical user interface (GUI). While it may seem intimidating at first, learning how to use the command line can greatly increase productivity and efficiency.
One of the main advantages of the command line is its speed. With just a few keystrokes, users can perform complex tasks that would take much longer to accomplish using a GUI. Additionally, the command line provides access to a wide range of tools and utilities that are not available through a graphical interface.
Another benefit of the command line is its flexibility. Users can customize their environment and create scripts to automate repetitive tasks. This can save time and reduce the risk of errors.
To get started with the command line, users need to open a terminal window. This can be done by searching for “terminal” in the operating system’s search bar or by using a keyboard shortcut. Once the terminal is open, users can begin entering commands.
Some basic commands include “ls” to list the contents of a directory, “cd” to change directories, and “mkdir” to create a new directory. Users can also use the “man” command to access the manual pages for a specific command and learn more about its usage.
Overall, the command line is a powerful tool that can greatly enhance a user’s productivity and efficiency. While it may take some time to learn, the benefits are well worth the effort.
Cheat Sheet
This cheat sheet provides a comprehensive list of command line commands and their descriptions.
Navigation
Command | Description |
---|---|
cd | Change directory |
ls | List files and directories |
pwd | Print working directory |
mkdir | Make directory |
rmdir | Remove directory |
touch | Create a new file |
cp | Copy files or directories |
mv | Move or rename files or directories |
rm | Remove files or directories |
cat | Concatenate and display files |
more | Display output one screen at a time |
less | Display output one screen at a time, with more features |
head | Display the first few lines of a file |
tail | Display the last few lines of a file |
grep | Search for a pattern in a file |
find | Search for files and directories |
locate | Find files and directories by name |
which | Find the location of a command |
File Management
Command | Description |
---|---|
chmod | Change file permissions |
chown | Change file ownership |
chgrp | Change file group |
tar | Create or extract a tar archive |
gzip | Compress or decompress files |
gunzip | Decompress a gzip file |
zip | Create or extract a zip archive |
unzip | Extract files from a zip archive |
dd | Copy and convert files |
df | Display disk usage |
du | Display disk usage of files and directories |
ln | Create a link to a file or directory |
stat | Display file or file system status |
file | Determine file type |
wc | Count lines, words, and characters in a file |
sort | Sort lines in a file |
uniq | Remove duplicate lines from a file |
cut | Extract columns from a file |
paste | Merge lines from multiple files |
diff | Compare files line by line |
patch | Apply a patch to a file |
System Information
Command | Description |
---|---|
uname | Display system information |
whoami | Display current user |
who | Display logged in users |
w | Display logged in users and their processes |
ps | Display running processes |
top | Display system resource usage |
free | Display memory usage |
df | Display disk usage |
du | Display disk usage of files and directories |
ifconfig | Display network interface configuration |
netstat | Display network connections |
ping | Test network connectivity |
traceroute | Trace network path to a host |
nslookup | Look up IP address for a domain name |
dig | Look up DNS information |
route | Display or modify network routing table |
User Management
Command | Description |
---|---|
useradd | Add a new user |
userdel | Delete a user |
usermod | Modify a user |
passwd | Change user password |
su | Switch user |
sudo | Execute a command as another user |
chsh | Change user shell |
chfn | Change user information |
finger | Display user information |
who | Display logged in users |
w | Display logged in users and their processes |
Process Management
Command | Description |
---|---|
ps | Display running processes |
top | Display system resource usage |
kill | Send a signal to a process |
killall | Kill processes by name |
nice | Set process priority |
renice | Change process priority |
bg | Run a process in the background |
fg | Bring a process to the foreground |
jobs | Display background jobs |
nohup | Run a command that continues after logout |
screen | Run a command in a virtual terminal |
Miscellaneous
Command | Description |
---|---|
echo | Display a message |
date | Display or set the system date and time |
cal | Display a calendar |
bc | Command line calculator |
history | Display command history |
alias | Create a command alias |
export | Set environment variables |
source | Execute commands from a file |
sleep | Pause for a specified time |
watch | Execute a command repeatedly |
tee | Redirect output to a file and stdout |
script | Record a terminal session |
clear | Clear the terminal screen |
reset | Reset the terminal |
man | Display manual pages |
apropos | Search for a command by keyword |
info | Display info pages |
whereis | Find the location of a command |
whatis | Display a brief description of a command |
which | Find the location of a command |
Conclusion
This cheat sheet provides a comprehensive list of command line commands and their descriptions. Use it as a reference to help you navigate and manage your system more efficiently.
Reference: