List directory contents
ls -la
Use 'ls -lah' for most comprehensive view
Change directory
cd /path/to/directory
Use 'cd -' to toggle between last two directories
Print working directory
pwd
Shows the full path of current directory
Copy files and directories
cp -r source destination
Move/rename files and directories
mv oldname newname
Remove files or directories
rm -rf directory
Be careful with rm -rf, it's irreversible!
Change file permissions
chmod 755 file.txt
Use numeric (777) or symbolic (u+x) notation
Report process status
ps aux
Display system processes
top
Terminate processes
kill -9 PID
Network statistics
netstat -tulpn
Test network connectivity
ping -c 4 google.com
Secure shell remote login
ssh user@hostname
Control the systemd system and service manager
systemctl status service-name
Query the systemd journal
journalctl -u service-name
Report file system disk space usage
df -h
Create a new user
useradd -m username
Package management
apt install package-name
Use apt-get for scripts, apt for interactive use
Search text patterns in files
grep 'pattern' file.txt
Use -R for recursive search including symlinks
Search for files in directory hierarchy
find /path -name '*.txt'
Powerful tool for finding files with various criteria
Archive files
tar -czvf archive.tar.gz directory/
Common formats: .tar.gz, .tgz, .tar.bz2
Download files from the web
wget https://example.com/file
Transfer data from/to a server
curl -X GET https://api.example.com
Estimate file space usage
du -sh *
Display memory usage
free -h
Interactive process viewer
htop
More user-friendly alternative to top
Command line history
history | grep ssh
Use !n to execute command number n from history
Output the last part of files
tail -f /var/log/syslog
Commonly used for log monitoring
Output the first part of files
head -n 10 file.txt
View file content with pagination
less file.txt
More feature-rich than more command
Change file owner and group
chown user:group file
Execute command as superuser
sudo command
Use sudo -i for root shell
Print system information
uname -a