Linux Command Bible
Table of Contents
-
Getting Started
-
Basic Commands
-
Git command
-
User Management
-
System Maintenance
-
System Logs
-
Process Management
-
Network Management
-
Filesystem Management
-
Security
-
Disk Management
-
System Performance Monitoring
-
Software Package Management
-
System Backup and Restore
-
System Maintenance and Updates
-
Network Configuration and Troubleshooting:
-
Security and Permissions
-
System Monitoring and Resource Usage2
-
Advanced Process Management
-
Contributing
-
License
Getting Started
If you're new to Linux, start here! This section will cover the basics, including how to access the command line and essential concepts.
Basic Commands
Change Directory
cd [directory]
List Files
ls
Make Directory
mkdir [directory_name]
Create a File
touch [file_name]
Copy File
cp [source_file] [destination]
Move/Rename File
mv [old_name] [new_name]
Remove/Delete File
rm [file_name]
Open a File in a Text Editor (e.g., Nano):
nano [filename]
Open a File in a Text Editor (e.g., vi):
vi [filename]
Git command
Clone a Repository from GitHub:
git clone https://github.com/username/repository.git
Check Git Status:
git status
Stage your changes:
git add README.md
Commit the changes:
git commit -m "Updated Linux Bible in README.md"
Push the changes to GitHub:
git push origin master
[!IMPORTANT]
If you're working on a branch other than master, replace it with the appropriate branch name.
If this is your first time pushing to the repository, Git may prompt you to configure your username and email:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Check the status:
git status
System Administration
Display System Information:
uname -a
View CPU Information:
lscpu
Check Memory Usage:
free -m
Disk Space Usage:
df -h
User Management
Add a User:
sudo adduser username
Add a User to the sudo Group:
sudo usermod -aG sudo username
Change User Password:
passwd username
Delete a User:
sudo deluser username
System Maintenance
Update Package Lists:
sudo apt update
Upgrade Installed Packages:
sudo apt upgrade
Install a New Package:
sudo apt install packagename
Restart the System:
sudo reboot
System Logs
View System Logs:
journalctl
Check Last System Reboot Time:
last reboot
Process Management
List Running Processes:
ps aux
Kill a Process:
kill PID
Check System Load:
uptime
Monitor System Resources:
top
Network Management
Display Network Configuration:
ifconfig
Check Open Ports:
netstat -tuln
Verify Connectivity:
ping example.com
View Network Statistics:
netstat -s
Filesystem Management
Check Filesystem Integrity:
fsck /dev/sda1
Find Large Files:
find / -type f -size +100M
[!NOTE]
Searches for files larger than 100 megabytes on the system.
Security
Update Security Packages:
sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
Check for Rootkits:
rkhunter --check
Firewall Configuration (using UFW):
sudo ufw status
sudo ufw allow 22
sudo ufw enable
[!NOTE]
Checks the firewall status, allows SSH traffic, and enables the firewall.
System Information
List USB Devices:
lsusb
Check PCI Devices:
lspci
[!NOTE]
Lists PCI devices connected to the system.
User and Group Management
List All Users:
getent passwd
[!NOTE]
Shows a list of all user accounts on the system.
List All Groups:
getent group
Change User's Primary Group:
usermod -g newgroup username
Disk Management
Check Disk I/O Statistics:
iostat
View Filesystem Mount Points:**
df -hT
System Performance Monitoring
Monitor CPU Usage (using htop)
sudo apt install htop
htop
[!NOTE]
Interactive process viewer that provides a visual representation of CPU and memory usage.
Check System Temperature (using lm-sensors)
sudo apt install lm-sensors
sensors
Software Package Management
Search for a Package:
apt search packagename
Remove Unused Dependencies:
sudo apt autoremove
System Backup and Restore
Create a System Backup (using tar):
tar -cvzf backup.tar.gz /path/to/backup
Restore from Backup:
tar -xvzf backup.tar.gz -C /path/to/restore
System Maintenance and Updates
Check for System Updates (using apt):
sudo apt update
Clean Package Cache:
sudo apt clean
Monitor System Logs (using journalctl):
journalctl -xe
Network Configuration and Troubleshooting
Configure Network Interfaces:
sudo nano /etc/network/interfaces
DNS Troubleshooting (using nslookup or dig):
nslookup example.com
or
dig example.com
Security and Permissions
Check File Permissions:
ls -l filename
Check System Security Updates (using unattended-upgrades):
cat /var/log/unattended-upgrades/unattended-upgrades.log
System Monitoring and Resource Usage
Check System Resource Usage (using sar):
sudo apt install sysstat
sar -u
Monitor Disk Space Usage (using du):
du -h
Advanced Process Management
Monitor Process Resources (using pidstat):
sudo apt install sysstat
pidstat 1
Background Process Management (using nohup):
nohup command &
License
This Linux Command Bible is licensed under [Apache-2.0 license]. See the LICENSE file for details.