Advance Linux Command
USERS MANAGEMENT
User management in Linux refers to the process of creating, configuring, and managing user accounts on a Linux system.
useradd
Command:
useradd [options] username
Meaning: The
useradd
command is used to create a new user account on the system. It adds a new user entry to the system's user account files, creates the user's home directory, and sets initial user attributes such as the home directory and login shell.
usermod
Command:
usermod [options] username
Meaning: The
usermod
command is used to modify or change user account properties. It allows you to update attributes like the username, home directory, login shell, group membership, and more for an existing user.
userdel
Command:
userdel username
Meaning: The
userdel
command is used to delete or remove a user account from the system. It removes the user's entry from the system's user account files and may also delete the user's home directory and associated files.
GROUP MANAGEMENT
Group management in Linux refers to the administration of user groups on a Linux system. It involves creating, modifying, and deleting groups, as well as assigning users to these groups.
groupadd
Meaning: groupadd
is used to create a new user group in Linux.
command: sudo groupadd mygroup
groupmod
Meaning: groupmod
is used to modify attributes of an existing user group in Linux.
command: sudo groupmod -n newgroupname oldgroupname
groupdel
Meaning: groupdel
is used to delete an existing user group in Linux.
command: sudo groupdel mygroup
Here is the next set of commands!
grep command
Meaning: grep
is used to search and filter text data in files. It searches for lines in files that match a specified pattern or regular expression.
grep is case-sensitive, meaning it distinguishes between uppercase and lowercase characters when searching for a pattern. This means that if you search for a pattern in lowercase, it will only match lines that contain the same pattern in lowercase.
awk command
Meaning: awk
is a text processing tool used for data extraction and manipulation. It processes text line by line and allows you to define actions based on patterns within the text.
awk '{print $2}' file.txt
find command
Meaning: find
is used to search for files and directories within a directory hierarchy. It searches for files based on various criteria, such as name, size, type, and more.
command :find . -type f -name "*.txt"
File permissions
File permissions in Linux are a crucial aspect of the system's security model. They determine who can access, modify, or execute files and directories. File permissions are set for three types of users:
Owner (user): The user who owns the file or directory.
Group: A group of users who have certain permissions on the file or directory. All users in the group share these permissions.
Others (world): All other users who are not the owner or part of the group.
File permissions are represented using a three-character code or a nine-character code, known as the "permission mode."
The three-character code (e.g.,
rwx
) represents the permissions for the owner, group, and others in that order.The nine-character code (e.g.,
rwxr-xr--
) includes additional information, such as special permissions, the file type, and extended attributes.
Here's what each character in the permission mode represents:
r
(read): The user can view the file's contents or list a directory's contents.w
(write): The user can modify the file's contents or create and delete files in a directory.x
(execute): For files, it allows the user to run the file as a program. For directories, it permits entering and accessing files within the directory.
systemctl command
systemctl
is used to start, stop, restart, enable, disable, and check the status of services in a Linux system that uses the systemd init system. It's a versatile tool for managing system services.
start service
stop service
status service
We can Replace service name
with the name of the specific service you want to manage. These commands are used to control services in a Linux system that uses system.
THANK YOU FOR READING!
Subscribe to my newsletter
Read articles from Manasa J directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by