Advance Linux session
Hi All,
We learned below Linux topics in today's session.
1- User/Group.
2-Grep, awk, find
3-Permissions
4-Ssh and SCP
5-Systemctl and apt install.
1-What is User/Group?
useradd is a Linux command for creating a new user. It requires various options to add and set up an active user account. Additionally, the command allows changing default values for the user creation process.
useradd is a low-level, portable command available on all Linux distributions.
Example:- Sudo useradd shubham-devops
groupadd command creates a new group account using the values specified on the command line and the default values from the system.
Example:- sudo groupadd DevOps
2- Grep:- Grep is a good tool to use when you need to search for a text pattern in a file. For example, you may need to search for specific text in a system log file.
Example:-grep "ErrorLog" /etc/apache2/apache2.conf
AWK:-The awk
command is a Linux tool and programming language that allows users to process and manipulate data and produce formatted reports. The tool supports various operations for advanced text processing and facilitates expressing complex data selections.
Example:-awk -F ',' '{if($2==$3){print $1","$2","$3} else {print "No Duplicates"}}' answers.txt
The find:- Find command can be used in a variety of conditions like you can find files by permissions, users, groups, file types, date, size, and other possible criteria.
Example:-find /etc -type f -name file1.txt
Permissions:- When permissions and users are represented by letters, that is called symbolic mode. For users, u
stands for user owner, g
for group owner, and o
for others. For permissions, r
stands for read, w
for write, and x
for execute.
Read (r)
Read permission is used to access the file's contents. You can use a tool like cat
or less
on the file to display the file contents. You could also use a text editor like Vi or view
on the file to display the contents of the file. Read permission is required to make copies of a file, because you need to access the file's contents to make a duplicate of it.
Write (w)
Write permission allows you to modify or change the contents of a file. Write permission also allows you to use the redirect or append operators in the shell (>
or >>
) to change the contents of a file. Without write permission, changes to the file's contents are not permitted.
Execute (x)
Execute permission allows you to execute the contents of a file. Typically, executables would be things like commands or compiled binary applications. However, execute permission also allows someone to run Bash shell scripts, Python programs, and a variety of interpreted languages.
What is SSH and SCP.
SSH stands for Secure Shell or Secure Socket Shell. It is a cryptographic network protocol that allows two computers to communicate and share the data over an insecure network such as the internet. It is used to login to a remote server to execute commands and data transfer from one machine to another machine.
ssh UserName@SSHserver.test.com
The scp command copies files or directories between a local and a remote system or between two remote systems. You can use this command from a remote system (after logging in with the ssh command) or from the local system. The scp command uses ssh for data transfer.
scp Desktop/sample_example.txt root@136.183.142.28:/home/remote_dir
Please follow for more Blogs.
#shubhamlondhe #DevOps #Shubhamt5695