Day- 2 of #90days-of-DevOps-Journey
Shubham Niranjan
NOC Engineer | ?? AWS | ?? Linux | ?? Docker | ?? Kubernetes | ?? Jenkins | ?? Git & GitHub | ?? Python | ??? CI/CD | ?? Cloud Infrastructure | ?? Automation | ?? Monitoring & Logging | ?? DevOps Enthusiast
Today, I enabled WSL2 (Windows Subsystem for Linux) on my Windows machine and practiced the following Linux commands:
File Management Command
In Linux, file management commands are used to manage files and directories. Those who regularly work with the Linux operating system, whether they are users, system administrators, or developers will find these commands invaluable.
ls - List files and directories
cd - Change directory
cp - Copy files and directories
mv - Move (rename) files and directories
rm - Remove files and directories
mkdir - Create directories
rmdir - Remove empty directories
touch - Create an empty file or update the timestamp of an existing file
chmod - Change permissions for files and directories
chown - Change ownership of files and directories
ln - Create links between files
find - Search for files and directories based on various criteria
locate - Find files and directories by name
grep - Search for patterns in files
head - Display the first few lines of the file
tail - Display the last few lines of the file
cat - Concatenate and display files
more - Display the contents of the file one screen at a time
less - Display the contents of the file one screen at a time, with more advanced features
tar - Create or extract tar archives
gzip - Compress or decompress files using gzip compression
bzip2 - Compress or decompress files using bzip2 compression
Text Processing Command
Text Processing Commands are a set of built-in commands that are used to manipulate text. These commands allow users to quickly and efficiently search, modify, and extract data from text files.
cat - Concatenate and display files Ex- cat file1.txt file2.txt
sort - Sort lines of text files Ex- sort file.txt
uniq - Remove duplicate lines from a sorted file Ex- sort file.txt | uniq
grep - Search for patterns in files Ex- grep "pattern" file.txt
cut - Extract columns of text from files Ex- cut -f1,3 file.txt
sed - Stream editor for filtering and transforming text Ex- sed 's/old/new/' file.txt
awk - Pattern scanning and processing language Ex- awk '{print $1, $3}' file.txt
tr - Translate or delete characters Ex- tr 'a-z' 'A-Z' < file.txt
wc - Count lines, words, and characters in a file Ex- wc file.txt
diff - Compare two files and show differences Ex- diff file1.txt file2.txt
patch - Apply a diff file to a file or directory Ex- patch file.txt patch.diff
nl - Number lines in a file Ex- nl file.txt
head - Display the first few lines of a file Ex- head file.txt
tail - Display the last few lines of a file Ex- tail file.txt
tee - Redirect output to a file and to the terminal Ex- ls | tee output.txt
fmt - Format text files for printing Ex- fmt file.txt
pr - Convert text files for printing Ex- pr file.txt
iconv - Convert character encoding of a file Ex- iconv -f utf-8 -t iso- 8859-1 file.txt
dos2unix - Convert DOS line endings to UNIX line endings Ex- dos2unix file.txt
rev - Reverse lines of a file Ex- rev file.txt
领英推荐
fold - Wrap lines of text to a specified width fold Ex- -w 80 file.txt
join - Join lines from two files based on a common field Ex- join file1.txt file2.txt
Linux System Information Command
In Linux, system information commands provide information about hardware, software, and configuration elements of the system. This command will provide information such as kernel version, distribution name, distribution version, processor type, memory usage, network configuration, and processes running. Administrators and users can use these commands to examine the performance and status of the system and troubleshoot problems. In order to maintain and manage a Linux system, you need to know the Linux system information commands.
uname -a - Displays detailed information about the Linux kernel
lsb_release -a - Provides information about the Linux distribution installed on the system
top - Displays real-time information about the system's processes
free -m - Displays information about the system's memory usage
df -h - Displays information about the system's disk usage
uptime - Displays how long the system has been running and the average system load
lspci - Displays information about the system's PCI buses and devices
lsusb - Displays information about the system's USB buses and devices
hwinfo - Displays detailed hardware information about the system
dmidecode - Displays detailed information about the system's hardware components
cat /proc/cpuinfo - Displays detailed information about the system's CPU
cat /proc/meminfo - Displays detailed information about the system's memory usage
ifconfig - Displays information about the system's network interfaces
netstat -a Displays information about the system's network connections
netstat -ntlp - It displays active network connections and their associated processes or programs. Combining these options allows system administrators to easily identify applications or processes that use network connections and troubleshoot network-related issues.
iptables - L Displays information about the system's firewall rules
User Management Command
Linux user management commands create, modify, and delete user accounts and groups. Similarly, these commands are used to manage user account properties such as login shells, primary groups, and passwords. User management commands help system administrators control access to resources and manage user permissions on Linux systems to ensure security and accessibility.
useradd - By using this command, you can create a new user account on the system.
usermod - This command is used to modify an existing user account, such as changing the user's password or group membership.
userdel This command is used to delete an existing user account from the system.
passwd - This command is used to change a user's password.
groupadd This command is used to create a new group on the system.
groupmod This command is used to modify an existing group, such as changing the group's name or membership.
groupdel -This command is used to delete an existing group from the system.
id This command is used to display information about a user or group, including their user ID and group membership.
chown -This command is used to change the owner of a file or directory.
chgrp - This command is used to change the group ownership of a file or directory.
chmod - This command is used to change the permissions of a file or directory.
su - This command is used to switch to another user account or become a superuser.
sudo - This command is used to execute a command with elevated privileges.
whoami - This command is used to display the username of the current user.
w - This command is used to display information about logged-in users and their activity on the system.
finger [username] - Displays detailed information about a user, including their login name, home directory, and shell. last Displays information about the last logged-in users on the system.
who - Displays information about currently logged-in users in the system.
adduser [username] - Create a new user account with interactive prompts to enter user details.
deluser [username] - Deletes a user account and their home directory from the system.
newgrp [groupname] - Change the user's primary group membership to a new session.
usermod -aG [groupname] [username] - Adds a user to an additional group.
chsh -s [shellpath] [username] - Change the user's login shell.
chfn [username] - Change the user's full name and other details in the system password file.
visudo - Edit the sudo configuration file, which controls which users can execute commands with elevated privileges.
?? Domain Specialist @ Ericsson | ?? DevOps Engineer |?? Terraform | ??? Azure DevOps | ?? Docker | ?? K8s | ?? Linux | Troubleshooting | Automation | ?? CI/CD
5 个月Very informative