Author: Trix Cyrus
Waymap Pentesting tool: Click Here
TrixSec Github: Click Here
TrixSec Telegram: Click Here
Linux commands form the backbone of interacting with Unix-like operating systems. Whether you're a beginner or a seasoned pro, having a comprehensive reference can significantly boost your productivity. Here's the ultimate Linux command cheat sheet for 2024, categorized for ease of use.
1. Basic Commands
-
ls
– List directory contents -
cd
– Change directory -
pwd
– Print working directory -
mkdir
– Create directories -
touch
– Create an empty file -
rm
– Remove files or directories -
cp
– Copy files or directories -
mv
– Move or rename files -
echo
– Display text in the terminal
2. File and Directory Management
-
cat
– View file content -
less
– View file content with backward navigation -
head
– Display the first few lines of a file -
tail
– Display the last few lines of a file -
find
– Search for files and directories -
locate
– Quickly find files using an indexed database -
df
– Report disk space usage -
du
– Estimate file or directory sizes
3. User and Group Management
-
whoami
– Display the current user -
id
– Show user and group IDs -
passwd
– Change user password -
useradd
– Add a new user -
usermod
– Modify an existing user -
groupadd
– Create a new group -
su
– Switch user accounts -
sudo
– Execute commands as another user
4. Networking Commands
-
ping
– Check network connectivity -
curl
– Transfer data from or to a server -
wget
– Download files from the internet -
ifconfig
– Configure or view network interfaces -
ip a
– Display IP address information -
netstat
– Show network connections -
traceroute
– Trace the route of packets to a host -
nmap
– Network scanner for security auditing
5. System Monitoring
-
top
– View active processes and resource usage -
htop
– Interactive process viewer -
ps
– Display information about active processes -
uptime
– Show how long the system has been running -
free
– Display memory usage -
vmstat
– Virtual memory statistics -
iostat
– Report CPU and disk I/O usage
6. Package Management
Debian-Based Systems:
-
apt install [package]
– Install a package -
apt remove [package]
– Remove a package -
dpkg -i [package.deb]
– Install a.deb
package
RPM-Based Systems:
-
yum install [package]
– Install a package -
rpm -i [package.rpm]
– Install a.rpm
package -
dnf update
– Update system packages
7. Permissions and Ownership
-
chmod
– Change file permissions -
chown
– Change file owner -
umask
– Set default file permissions -
ls -l
– Display permissions of files
8. Archive and Compression
-
tar -czvf [file].tar.gz [folder]
– Compress files using tar and gzip -
zip [file].zip [folder]
– Create a ZIP archive -
unzip [file].zip
– Extract a ZIP archive -
gzip [file]
– Compress a file -
gunzip [file].gz
– Decompress a file
9. Disk Management
-
fdisk
– Partition a disk -
lsblk
– View information about block devices -
mkfs.ext4 /dev/[disk]
– Create an ext4 filesystem -
mount /dev/[disk] /mnt
– Mount a disk -
umount /mnt
– Unmount a disk
10. Advanced Commands
-
awk
– Process and analyze text -
sed
– Stream editor for transforming text -
cron
– Schedule repetitive tasks -
ssh
– Secure shell access to remote systems -
rsync
– Synchronize files and directories -
tcpdump
– Capture network packets -
iptables
– Configure firewall rules
11. Fun and Miscellaneous Commands
-
cowsay "Hello, Linux!"
– Display a message with a talking cow -
fortune | cowsay
– Generate a random quote with a talking cow -
sl
– A steam locomotive animation (install required) -
cal
– Display a calendar
~Trixsec
Top comments (2)
the way to use APT with
apt-get
is deprecated, we can just useapt
now, it seems simple, but it's always good to use it in the most current way as indicated.Thanks for the article and the tips.
Thank you for pointing that out!
You're absolutely right—apt-get has been largely replaced by the apt command, which simplifies package management and is the preferred method in modern Debian-based systems. I'll update the article to reflect this more current approach.