Linux Commands-2
Linux Commands-2
3. Process Management
ps – Report a snapshot of current processes
top – Display Linux tasks
htop – Interactive process viewer (advanced top)
kill – Send a signal to a process, typically to terminate
killall – Terminate processes by name
bg – Resume a suspended job in the background
fg – Bring a job to the foreground
jobs – List active jobs
nice – Run a program with modified scheduling priority
renice – Alter priority of running processes
uptime – Show how long the system has been running
time – Measure program running time
4. Disk Management
df – Report file system disk space usage
du – Estimate file space usage
fdisk – Partition table manipulator for Linux
lsblk – List information about block devices
mount – Mount a file system
umount – Unmount a file system
parted – A partition manipulation program
mkfs – Create a file system
fsck – File system consistency check and repair
blkid – Locate/print block device attributes
5. Networking
ifconfig – Configure network interfaces
ip – Show/manipulate routing, devices, and tunnels
ping – Send ICMP Echo requests to network hosts
Page | 2
netstat – Network statistics
ss – Socket statistics (faster than netstat)
traceroute – Trace the route packets take to a network host
nslookup – Query Internet name servers interactively
dig – DNS lookup utility
wget – Non-interactive network downloader
curl – Transfer data with URLs
scp – Secure copy files between hosts
ssh – Secure shell for remote login
ftp – File Transfer Protocol client
using gzip
o tar -xzf archive.tar.gz – Extract gzipped tarball
General Commands
rpm – RPM package manager
o rpm -i <package.rpm> – Install an RPM package
on boot
o systemctl status <service> – Check service status
Page | 5
11. Scheduling Tasks
cron – Daemon for running scheduled commands
o crontab -e – Edit cron jobs for the current user
over SSH
cpio – Copy files to and from archives
dd – Low-level copying and backup of entire filesystems
Page | 6
o dd if=/dev/sda of=/path/to/backup.img – Backup a
disk/partition
o dd if=/path/to/backup.img of=/dev/sda – Restore a
disk/partition
Page | 7
o ip route – Show or manipulate routing tables
ss – Display socket statistics (useful for diagnosing network
issues)
nmap – Network exploration tool (can be used for security
auditing)
telnet – User interface to the TELNET protocol (less common
nowadays)
nc (Netcat) – Network utility for reading and writing from network
connections
o nc -l -p 1234 – Listen on port 1234
remote server
rsync – Remote file and directory synchronization (often used for
backups)
o rsync -avz /local/path/ remote:/remote/path/ – Sync
directories
a file
cut – Remove sections from each line of a file
o cut -d ':' -f 1 /etc/passwd – Print the first field of each line,
delimited by ":"
sort – Sort lines of text files
o sort file.txt – Sort file content in ascending order
tee – Read from standard input and write to standard output and
files
o echo "text" | tee file.txt – Write to file and show output on
screen
tr – Translate or delete characters
o echo "hello" | tr 'a-z' 'A-Z' – Convert lowercase to uppercase
by side
wc – Word, line, character, and byte count
o wc -l file.txt – Count lines in a file
o init 6 – Reboot
to 755
setfacl – Set access control lists (ACL) for file permissions
getfacl – Get access control lists (ACL) for file permissions
Page | 10
20. Containerization and Orchestration
Docker
from a Dockerfile
o docker exec -it <container_id> bash – Start an
applications
docker-compose up – Start up a multi-container
environment
docker-compose down – Stop and remove containers
created by docker-compose
docker-compose logs – View logs from containers
managed by docker-compose
Kubernetes (k8s)
Page | 11
o kubectl apply -f <file>.yaml – Apply configuration
from a file (e.g., a deployment or pod configuration)
o kubectl create -f <file>.yaml – Create a resource
from a file
o kubectl delete -f <file>.yaml – Delete a resource
defined in a file
o kubectl exec -it <pod_name> -- bash – Execute a
command inside a pod (e.g., open a shell)
o kubectl logs <pod_name> – View the logs of a pod
o kubectl describe pod <pod_name> – Get detailed
information about a pod
o kubectl scale deployment <deployment_name> --
replicas=<number> – Scale a deployment to the desired
number of replicas
o kubectl rollout restart deployment
<deployment_name> – Restart a deployment
o kubectl port-forward pod <pod_name>
<local_port>:<remote_port> – Forward a port from a
pod to localhost
Helm
helm – Kubernetes package manager for deploying applications
o helm install <release_name> <chart_name> –
Terraform configuration
o terraform plan – Show an execution plan (preview of
Terraform configuration
o terraform destroy – Destroy infrastructure created by
Terraform
o terraform validate – Validate the configuration files
infrastructure
Puppet
manifest locally
o puppet agent --test – Test the Puppet agent (can be
GitLab CI
.gitlab-ci.yml – Configuration file for GitLab CI/CD pipelines
(typically resides in your repository)
o gitlab-runner register – Register a new runner with
GitLab
o gitlab-runner run – Run the GitLab Runner to process
jobs
GitHub Actions
your CI pipeline
o actions/setup-node@v2 – Setup Node.js for use in a
pipeline
o docker/setup-buildx-action@v1 – Set up Docker
Page | 14
o aws s3 cp file.txt s3://bucket-name/ – Copy a
file to an S3 bucket
o aws ec2 describe-instances – Describe EC2 instances
o aws ec2 start-instances --instance-ids <id> –
Start an EC2 instance
o aws ec2 stop-instances --instance-ids <id> –
Stop an EC2 instance
o aws s3 sync – Sync directories with an S3 bucket
blob storage
o az group create – Create a new resource group in Azure
instances
o gcloud compute instances stop <instance_name>
Page | 15
prometheus – Open-source system monitoring and alerting
toolkit
o prometheus – Start Prometheus server (usually runs as a
Grafana
grafana-cli – Command-line interface for managing Grafana
plugins
o grafana-cli plugins install <plugin-name> –
'localhost:9200/_cluster/health?pretty' – Get
cluster health status
logstash – Server-side data processing pipeline
o logstash -f <config_file> – Run Logstash with the
(http://localhost:5601)
Page | 16