This content originally appeared on DEV Community and was authored by Rubin
Linux commands form the backbone of navigating and managing a Linux system efficiently through the terminal. Whether you're a beginner or an experienced user, mastering these commands will greatly enhance your productivity and control over your system. In this article, here are the top Linux commands that every user should master for effective terminal usage
Navigation and File Management
cd: Change directory
cd directory_name
ls: List directory contents
ls options directory_path
pwd: Print working directory
pwd
cp: Copy files and directories
cp source_file destination_file
mv: Move (rename) files and directories
mv source destination
rm: Remove files and directories
rm file_name
mkdir: Make directories
mkdir directory_name
rmdir: Remove empty directories
rmdir directory_name
cat: Concatenate and display files
cat file_name
less/more: View file contents interactively (one screen at a time)
less file_name
more file_name
head/tail: View the beginning or end of a file
head file_name
tail file_name
grep: Search for patterns in files
grep pattern file_name
find: Search for files in a directory hierarchy
find directory_path options
ln: Create links between files
ln -s target_file link_name
chmod: Change file permissions
chmod permissions file_name
chown: Change file owner and group
chown owner:group file_name
Process Management
ps: Display information about active processes
ps
kill: Terminate processes
kill process_id
top/htop: Display system processes in real-time
top
htop
System Information
df: Display disk space usage
df options
du: Estimate file space usage
du options file_name
free: Display amount of free and used memory in the system
free
uname: Print system information
uname -a
uptime: Show how long the system has been running
uptime
Network Management
ping: Check the connectivity to a server or network device
ping hostname_or_ip
ifconfig/ip: Display and configure network interfaces
ip addr show
netstat: Print network connections, routing tables, interface statistics, etc.
netstat options
wget/curl: Download files from the internet
wget URL
curl -O URL
System Administration
sudo: Execute a command as the superuser (root)
sudo command
shutdown/reboot: Shutdown or reboot the system
shutdown options
reboot
service/systemctl: Control system services (systemd-based systems)
systemctl start|stop|restart service_name
journalctl: Query and display system logs
journalctl options
passwd: Change user password
passwd
Text Processing
awk: A versatile programming language for pattern scanning and processing
awk 'pattern { action }' file
sed: Stream editor for filtering and transforming text
sed 's/search/replace/g' file
cut: Remove sections from each line of files
cut options file
sort: Sort lines of text files
sort options file
uniq: Report or omit repeated lines
uniq options file
wc: Print newline, word, and byte counts for each file
wc options file
Compression and Archiving
tar: Archive files and directories
tar options archive_name files
gzip/gunzip: Compress or decompress files
gzip file
gunzip file.gz
bzip2/bunzip2: Another compression utility
bzip2 file
bunzip2 file.bz2
Miscellaneous
echo: Display a line of text or variables
echo "Hello, world!"
date: Display or set the system date and time
date
watch: Execute a program periodically, showing output fullscreen
watch command
alias: Create an alias for a command
alias short_name='command sequence'
history: Display command history
history
whoami: Display the current username
whoami
touch: Change file timestamps or create empty files
touch file_name
scp/rsync: Securely copy files between hosts
scp file user@host:destination
rsync options source destination
Mastering these Linux commands will empower you to efficiently manage files, processes, networks, and more directly from the terminal. Whether you're a system administrator, developer, or Linux enthusiast, these commands are indispensable tools for your daily workflow.
Happy Linux command-line hacking!
This content originally appeared on DEV Community and was authored by Rubin
Rubin | Sciencx (2024-07-13T17:15:20+00:00) Linux Commands You Should Master. Retrieved from https://www.scien.cx/2024/07/13/linux-commands-you-should-master/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.