Linux Notes
Linux Notes
Short
notes
FOR DEVOPS ENGIN
EERS
TraIn
WTIh
Shubha
Linux Short
Notes
History of LINUX
Linux came from a Unix family, Linux is a free and open-source software
operating system, which Linus Torvalds developed in September 1991.
In 1991, Linus Torvalds was a student at the University of Helsinki, Finland,
USA.
He developed the first code of Linux 0.01 and post it on the minix newsgroup
on 17 Sep 1991, his code become so popular people encouraged him to
develop new code and he was led to develop new code and release the first
“o ffi cial” version of Linux, version 0.02 on October 5, 1991.
Today many year pass and Linux become one of the most popular operating
systems. Today 90% fastest Supercomputers out of 500 run on Linux variants
including the top 10.
TraIn
WITh
/
The base of the Linux directory is the root. This is the starting point of FSH.
Every directory arises from the root directory. It is represented by a forward
slash (/).
If someone says to look into the slash directory, they refer to the root
directory.
/root
It is the home directory for the root user (superuser).
/sbin → SystemBinaries
Just like /bin, /sbin also contains binary executables.
But, the linux commands located under this directory are used typically
by system aministrator, for system maintenance purpose.
For example: iptables, reboot, fdisk, ifconfig, swapon
TraIn
WITh
/ v a r → Variable Files
The variable data files such as log files are located in the /var directory.
File contents that tend to grow are located in this directory.
> This includes
◦
/var/log: System log files generated by OS and other applications.
◦
/var/lib: Contains database and package files.
◦
/var/mail: Contains Emails.
◦
/var/tmp: Contains Temporary files needed for reboot.
/ u s r → User Binaries
The /usr directory contains applications and files used by users, as opposed
to applications and files used by the system.
TraIn
WITh
Basic Commands
Create file or
directory
1. For create single directory
TraIn
WITh
Create file
Touch:
Touch command is use for create empty file, we c a n ’ t write data in a file,
c a n ’ t edit or save file.
TraIn
WITh
1. For copy file
User management
For create user account
TraIn
WITh
For check user account properties
Or
TraIn
WITh
For change user Login name
Group management
A group is a collection of user accounts that is very use full to administrators for
managing and applying permission to a number of users.
TraIn
WITh
For remove group member
permissio
n Link
Owner
Group
owner Size
of file
Date & time of file
creation Name of file
TraIn
WITh
Permission in details
Type of File Permission
Basic permission
Special
permission
Access Control List
(ACL) permission
Permission Group
Permission Description
Owner (u) → permissions used for the owner of
the file Group (g) → permissions used by
members of the group Other (o) → permissions
used by all other users
Permission Set
TraIn
WITh
For change permission
Syntax:
Syntax:
TraIn
WITh
Set permission with a numeric value
r (read) = 4
w (write) =
2
x (execute)
= 1
For set
permission
with a
numeric value
Access Control List (ACL)
Access control list (ACL) provides an additional, more flexible permission
mechanism for file systems.
Access control list is a service which is used for providing special permission
to specific users and group to particular directories and file
Use of ACL
TraIn
WITh
For set ACL permission to user
TraIn
WITh
Search a word (string in a file)
TraIn
WITh
Display the lines that start with a string
Find
The Linux Find Command is one of the most important and
much used command in Linux systems.
Find command used to search and locate the list of files and
directories based on conditions you specify for files that match
the arguments.
Find can be used in a variety of conditions like you can find files
by permissions, users, groups, file type, date, size, and other
possible criteria
TraIn
WITh
Find files with guid permission
WC (Word Count)
The wc command is use for the count word and line numbers.
TraIn
WITh
head
Head command is used for to display top line of the file.
tail
Tail command is used for to display the bottom line of the file.
Display bottom 10 line of the file
What is Tar
The Linux “ t a r ” stands for tape archive, which is used by large number of
Linux/Unix system administrators to compress size or drives backup. For create
archive tar used some compression algorithms Such as gzip,bz2 and xz
TraIn
WITh
Tar command syntax
To create
a tar
archive file
To show file size in human-readable format
TraIn
WITh
To create a tar archive file with compress in size (gzip)
Job Automation
Job automation allows us to perform tasks automatically in OS by using tools.
This feature is very useful for the administrator to assign tasks to OS whenever
he is not present or performing daily basis work.
To remove a job
TraIn
WITh
To show cron jobs of the current user
Or,
Go to the crontab file and remove the job line
TraIn
WITh
Sudo Command
What is sudo?
sudo (“superuser do”, or “switch user do”) allows a user with
proper permissions to execute a command as another user, such
as the superuser.
Provide sudo
privilege to the
group
For edit
configuration
file:
# vim
/etc/sudoers
%punegrp
ALL=(ALL) ALL
(line number
108)
:wq
By default, all
members
By default,ofall members of the wheel group got sudo TraIn
punegrp
privilegesgroup WITh
Sudo without password
For edit configuration file:
# vim /etc/sudoers
Or,
manage IP configuration
TraIn
WITh
manage IP configuration
To deactivate connection
To set hostname
To show hostname
TraIn
WITh
IP address configuration files
All created connections with nmcli and nmtui by default are stored in the
following file
Note
We can also modify the connection using the above connection file, but it
not recommended.
TraIn
WITh
Thank You
Dosto
TraIn
WTIh
Shubha