Linux Command
Linux Command
useradd – Add a user to the system zip – Package and compress files into a ZIP archive
usermod – Modify a user account unzip – Extract files from a ZIP archive
userdel – Delete a user account gzip – Compress files using the gzip algorithm
groupadd – Add a group to the system gunzip – Decompress files compressed with gzip
groupdel – Delete a group bzip2 – Compress files using the bzip2 algorithm
passwd – Change user password bunzip2 – Decompress files compressed with bzip2
chage – Change user password expiry information xz – Compress files using the xz algorithm
whoami – Print the current logged-in user unxz – Decompress files compressed with xz
who – Show who is logged in
w – Show who is logged in and what they’re doing 9. Package Management (Depends on Distribution)
id – Display user and group information
groups – Show user’s groups Debian-based (e.g., Ubuntu)
o yum update – Update installed packages cron – Daemon for running scheduled commands
o yum remove <package> – Remove a package o crontab -e – Edit cron jobs for the current user
dnf – Next-generation package manager (Fedora, CentOS 8+) o crontab -l – List the current user’s cron jobs
o dnf install <package> – Install a package o crontab -r – Remove the current user's cron jobs
o awk '{print $1}' file.txt – Print the first column of each line in
uniq – Report or omit repeated lines in a file fstab – File system table (configuration file for mounting file
o sort file.txt | uniq – Sort and remove duplicate lines
systems)
o /etc/fstab – View and configure persistent mount points
tee – Read from standard input and write to standard output and
files blkid – Display block device attributes
o echo "text" | tee file.txt – Write to file and show output on
fsck – Check and repair a file system
o fsck /dev/sda1 – Check and repair /dev/sda1
screen
tr – Translate or delete characters
o echo "hello" | tr 'a-z' 'A-Z' – Convert lowercase to uppercase
19. Filesystem Permissions and Security
paste – Merge lines of files chmod – Change file permissions
o paste file1.txt file2.txt – Combine lines of file1 and file2 side o chmod 755 file.txt – Give read, write, and execute
by side permissions to owner, and read-execute permissions to
wc – Word, line, character, and byte count others
o wc -l file.txt – Count lines in a file chown – Change file owner and group
o wc -w file.txt – Count words in a file o chown user:group file.txt – Change owner and group of a file
shutdown – Shut down the system umask – Set default permissions for new files
o umask 022 – Set default permissions for newly created files
o shutdown -h now – Immediately shut down
applications Helm
docker-compose up – Start up a multi-container
helm – Kubernetes package manager for deploying applications
environment
o helm install <release_name> <chart_name> –
docker-compose down – Stop and remove containers
Install a Helm chart
created by docker-compose
o helm upgrade <release_name> <chart_name> –
docker-compose logs – View logs from containers
Upgrade a Helm release
managed by docker-compose
o helm list – List all Helm releases
o aws ec2 stop-instances --instance-ids <id> – Prometheus with a specific config file
Stop an EC2 instance
o aws s3 sync – Sync directories with an S3 bucket Grafana
Azure CLI (Microsoft Azure) grafana-cli – Command-line interface for managing Grafana
plugins
az – Command-line tool for managing Azure services o grafana-cli plugins install <plugin-name> –
gcloud – Command-line tool for Google Cloud Platform specified configuration file
o gcloud auth login – Log in to Google Cloud kibana – Web interface for visualizing Elasticsearch data
o gcloud compute instances list – List compute o Kibana is generally accessed through a web browser
instances (http://localhost:5601)
o gcloud compute instances stop <instance_name>
Page | 15 Page | 16