Basic Linux Commands
Linux commands can be categorized into different groups based on their functionality. Here’s a list of essential Linux commands organized by groups:
File and Directory Operations
ls
: List directory contents.cat
: Display file contents.pwd
: Print current directory.cp
: Copy files/directories.mv
: Move/rename files/directories.rm
: Remove files/directories (caution).mkdir
: Create a new directory.rmdir
: Remove an empty directory.
File Viewing and Editing
cat
: Concatenate and display file content.touch
: Create an empty file.more
: Display content one screen at a time.less
: Display content with advanced features.head
: Display the beginning of a file.tail
: Display the end of a file.nano
: Simple text editor.vim
orvi
: Advanced text editor.
File Permissions
chmod
- Change file permissionschown
- Change file ownerchgrp
- Change file group
System Information
uname
: Display system information.df
: Display disk space usage.du
: Display file and directory space usage.top
: Display and manage system processes.free
: Display amount of free and used system memory.
User and Group Management
passwd
- Change user passworduseradd
- Add a new useruserdel
- Delete a usergroupadd
- Add a new groupgroupdel
- Delete a group
Package Management
apt
orapt-get
- Advanced Package Tool for Debian/Ubuntuyum
- Yellowdog Updater Modified for CentOS/RHELdnf
- Dandified Yum for Fedorapacman
- Package Manager for Arch
Networking
ifconfig
: Configure network interfaces.ping
: Test network connectivity.traceroute
: Display the route packets take to a network host.netstat
: Display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.hostname
: Display or set the system’s hostname.hostnamectl
: Control the system hostname and related settings.
Process Management
ps
- Display information about active processeskill
- Terminate a processkillall
- Kill processes by namepkill
- Signal processes based on their name
Archiving and Compression
tar
- Create or extract tar archivesgzip
- Compress or decompress fileszip
- Package and compress files in ZIP format
Search and Text Processing
grep
- Search for patterns in filesfind
- Search for files and directoriessed
- Stream editor for filtering and transforming text
System Shutdown and Reboot
shutdown
- Schedule a time for the system to be powered downreboot
- Restart the system immediately
File System Navigation
cd
- Change directorypwd
- Print working directory