Professional Documents
Culture Documents
uname -a
uname -r
uptime
hostname
___________________________________________________________________________________
_________
gnome-control-center region
gnome-control-center region
gnome-control-center region
LANG=fr_FR.utf8 date
LANG=fr_FR.utf8 date
LANG=fr_FR.utf8 date
LANG=fr_FR.utf8 date
CLI is command line interface--It is a text based interface which is used to enter
commands and to give instructions to computer
Linux command line is prvided by a program called as shell
Default shell in linux is bash GNU bourne-again shell bash
usermod -L morgan
GNOME shell
date +%R
date +%R
date +%X
date +%X
passwd
passwd
passwd
file /etc/passwd
file /etc/passwd
file /home
file /etc/bin
head /etc/passwd
tail -n 3 /etc/passwd
history
ls --al
ls --al
ls --al formatted listing with hidden files
rm -r rajan
rm -f rajan
rm -rf rajan forcefully removes directory rajan
rm -rf rajan
cp -r dir1 dir2 copy dir 1 to dir 2 and if dir 2 is not existing then will create
it.
cp -r dir1 dir2
mv rajan1 rajan2
ln -s file link
ln -s file link
ln -s file link
who is online w
whoami
whoami
whoami
finger user --display info abt user
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/cpuinfo
cat /proc/meminfo
man
man
df show disk usage
df show disk usage
du show directory usage
du
du
df
free show memory and swap usage
free show mem and swap usage
kill pid
kill pid
fg n
tar xf rajan.tar
tar xf rajan.tar
tar xf rajan.tar extract the file from rajan.tar
tar xf rajan.tar
gzip rajan
gzip rajan
gzip rajan compresses file and rename to rajan.gz
gzip -d rajan.gz
gzip -d rajan.gz
gzip -d rajan.gz decompresses rajan.gz back to rajan
gzip -d rajan.gz
ping host
whois domain
whois domain get whois info for domain
whois domain
dig domain
dig domain
dig domain get DNS info for domain
dig domain
dig -x host
dig -x host reverse lookup host
dig -x host
___________________________________________________________________________________
__________________________________
ssh admin@192.187.1.2
ssh admin@192.187.1.2
ssh admin@192.187.1.2:65022
ssh -p 65022 admin@192.187.1.2 ssh with port no.
exit
ctrl +d exit
date +%r
date +%r
ctrl+ right arrow--jump to the end of next word on the cmd line
/usr--installed software , shared lib , include file and read only program data
/usr--installed software ,,shard lib , inlcude file and read only program data
/usr--installed software,,shared lib, include file and read only program data
sub direc of /usr-- /usr/bin--user cmds
/var--variable data spcific to this system that should persist b/w boots
/var varaible data specific to this system that should persist b/w boots
//var--variable data specific to this system that should persist b/w boots
/run---run time data for processes started since the last boot
/run --run time data for the processes started since the last boot
/run--run time data for the processes started since the last boot
/home---home directories
/home--home dierctories
/dev--contains special device files that are used by the system to access hardware
/dev--contains special device files that are used by the system to access hardware
/dev--contains special device files that are used by the system to access hardware
ls -ltr : To sort the file names in the last modification time in reverse order
ls -ltr : to sort the file names in the last modification time in reverse order..
ls -ltr : to sort the file names in the last modification time in reverse order
cd --change directory
cd change directory
ln -s file1
ln -s file1
ln -s file1
| A pipe line is a sequence of one or cmds separated by the pipe character (|).
A pipe connects the std output of the first cmd to the std input of the next cmd.
A pipe connects the std output of the firt cmd to the std input of next cmd.
sudo su-
sudo su-
sudo su-
chmod chnages the file permission
___________________________________________________________________________________
_____________________________
LANG=fr_FR.utf8 date
LANG=en_US.utf8 date
LANG=en_US.utf8 date
The $ is replaced by a # if the shell is running as the superuser, root. This makes
it more obvious
that it is a superuser shell, which helps to avoid accidents and mistakes in the
privileged accou nt.
[root@desktopX -]#
- The visual cue that indicates an interactive shell is wating for the user to type
a command.--- Prompt
-
The name of a p rog ram to run. --Command
-
The part of the command line that adjusts the - behavior of a command.------Option
- The pa rt of the command line that specifies the ta rget that the command should
operate on.---- Argument
-
The hardware display and keyboard used to - interact with a system.---Physica l
conso le
·- One of multiple logical consoles that can each support an independent login
session.---- Virtual con so le
-
An interface that provides a display for output and a keyboard for input to a
shell session. ---Terminal -
The default des ktop environment in Red Hat Enterprise Linux 7 is provided by GNOME
3
Starting a terminal-- Select Appl icat ions > Ut ilities > Terminal
On an empty des ktop, rig ht-c l ick, or press the Menu key, and select Open in
Terminal from the
context menu that appears.
To lock the screen, select (User)> Lock or type Ct rl+Alt+L. The screen will lock
if the graphical
sess ion is idle for a few min utes.
To shut down the system, select (User)> Power Off from the top bar or type Ct rl+Al
t+Del
The file command scans the beginning of a file's contents and displays what type it
is.
The files to be classified are passed
as arguments to the command.
The wc command
----�------------------------------'
counts l i nes, words, and characters in a file. It can take a -l, - w, or -c
option
to display only the lines, words, or characters, respectively.
The ls command has multiple options for displaying attributes on fil es. The most
common and
usefu l are -1 (long l isting format), - a (a ll files, includes hidden fil es),
and -R (recursive, to include
the contents of all subdirectories
The command cd ~ changes directory to the directory where the user was previous to
the
current directory. Watch as this user ta kes adva ntage of this behavior to
alternate between two
directories, useful when process ing a series of similar tasks.
List the current user's home d irectory (long format) in simp l est syntax, when it
is not the c u rrent location. ---ls -l ~
The cd .. command uses the .. hidden directory to move up one leve l to the parent
d irectory,
without needing to know the exact parent name. The other hidden directory (.)
specifies the
current directory on commands in which the cu rrent location is either the source
or desti nation
arg ument. avoiding the need to type out the directory's absol ute path name.
cd ../..
rm file1
cp file1 file2
mv dir1 dir2--- lf dir2 exists, the result is a move. If dir2 doesn't exist, the
result is a
rename
mv dir1 dir2
rm -r dir1
rm -f file1 file2 file3----use caution with "force" option; you will not be
prompted to confirm
yo ur action.
mkdir -p par1/par2/dir
cd ../documents
cd ../dir1
ls -lR
ls -lR
rm -ri Thesis
rm -ri Thesis -ri will recursively remove directory thesis and all its content.
but due to i it will interactively prompt for each file or subdirectory deletion
from thesis directory
The rmdir command deletes directories only if empty. Removed directories ca n not
be
undeleted.
rmdir dir1
cd ../friends
~ ~ ~
~+ --current working directory.
~+ -- ~+ ~+
touch raja bravo extra dun kill cahe --will cerate all empty files with current
date and time
ls [ac]*
ls *a
ls a*
ls *a*
ls ????
The tilde character (~), when followed by a slash delimiter, matches the cu rrent
user's home
directory. When fo llowed by a stri ng of characters up to a slash, it will be
interpreted as a
username, if one matches. If no username matches, then an actual tilde followed by
the string of
characters will be returned.
Command su bstitution a l lows the output of a command to rep l ace the command
itse lf. Command
su bstitution occurs when a command is enc losed with a beginning dollar sign and
parenthesis,
$ ( command), or with backticks, · command'.
echo Today is 'date +%A'
desktopX
[[:space: ]] Any one whitespace character; may incl ude tabs, newline, or carriage
returns, and form feeds as we ll as space.
---Besides suppressing globbing and shell expa nsion, q uotations direct the shell
to additionally suppress
command and va ria ble su bstitution. The q uestion mark is a meta-character that
also needed
protection from expansion.
n
N
g
G
q
n---Repeat previous search forwa rd (down) in the man page
N---Repeat previous search bac kwa rd (up) in the man page
g---Go to start of the man page.
G----Go to end of the man page.
q---Exit man and return to the command shel l prompt
A keyword search of man pages is performed using man - k keyword, which displays a
l i st of
keyword-matching man page topics with section numbers.
man 1 gedit
man 1 gedit
gedit file1
gedit file1
passwd -l rajan
passwd -l rajan
passwd -u rajan
passwd -u rajan
man 1 passwd
man 1 passwd
man -f passwd
man -f passwd
man -f passwd
man -k zip
man -k zip
man -k zip
man -k boot
man -k boot
man -k boot
man -k ext4
man -k ext4
man -k ext4
man tar
pinfo tar
pinfo tar
pinfo tar
The less command is a Linux terminal pager that shows a file's contents one screen
at a time.
It is useful when dealing with a large text file because it doesn't load the entire
file but
accesses it page by page, resulting in fast loading speeds.
Using m u ltiple words with the - k option finds man pages matching either word; t
hose with
" postscript" or "viewer" in their descriptions.
firefox /usr/share/doc
Using firefox, open the system's package documentation directory and b rowse into
the
man - db package subdirectory. View the provided manual(s).
firefox /usr/share/doc
Processes are created with default connections for channels 0, 1, and 2, known as
standard input, standard
output, and standard error. Processes use channels 3 and above to connect to other
files.
Redirecting s tdout suppresses process output from a ppea ring on the terminal. As
seen
in the fol lowing table, redirecting only stdout does not suppress stderr e rror
messages
from displaying on the terminal. The special file /dev/null q u ietly di scards
channel output
redirected to it.
» file
redirect
stdout to a file, a ppend � •
to c u rrent file
content
> file1
>> file1 >> file1
>> file1
&>file &>file1 &>file1 &>file1 &>file1 combine stdout and stderr to one file
combine stdout and stderr to one file combine stdout and stderr to one file
&>file1 &>file1
>>file2>&1
>>file2>&1
>>file2>&1 >>file2>&1 >>file2>&1
>>file2>&1 combine stdout and stderr append to current file content
»file2>&1
>>file2>&1
ls -a /tmp/file1
ls -a /tmp/file1
ls -a /tmp/file1
echo "new line of information" >> /tmp/file1
echo "new line of information" >> /tmp/file1
2>/dev/null 2>/dev/null
&> file1
&> file1
&> file1
&> file1
>>file 2>&1
>>file 2>&1
>>file 2>&1 >>file 2>&1 >>file 2>&1
>>file 2>&1
ls -l /usr/bin | less
ls -l /usr/bin | less
ls -l /usr/bin | less
ls | wc -l > /tmp/file1
ls | wc -l > /tmp/file1
The tee command displays or redirects the intermediate result normally suppressed
due to
piping. In the first exa mple, the ls listing is viewed on a terminal while
simultaneously being
stored in a fi le.
>>file1 2>&1
>>file1 2>&1
>>file1 2>&1
&>/dev/null
&>/dev/null
In the shell command window, display today's date with day of the week, month,
date, and year.
V--Enter line-based
visual mode with upper case v.
Enter linebased visual mode with V. Move down using the down arrow key twice to
select the first
three rows. Delete the rows with x.
enter visual mode with the control sequence Ctrl - v, which a l lows
selecting a block of characters on m u ltiple l i nes.
Use the arrow keys to position the cursor at the first character of the g roup
owner column.
E nter visual mode with Ctrl-v. Use the arrow keys to position the cursor at the
last
character and row of the group owner column, as shown in the screenshot. Delete the
selection with x.
Use the arrow keys to pos ition the cursor at a ny character on the Desktop row. E
nter visual
mode with u pper case v. The fu ll line is sel ected, as shown in the screenshot.
Delete the
selection with x.
ps -f | tee -a file.txt
ps -f | tee -a file.txt
ps -f | tee -a file.txt
Every process (running prog ram) on the system runs as a particu lar user. Every fi
le is owned by
a particular user. Access to files and directories a re restricted by user. The
user associated with a
running p rocess determines the files and directories accessible to t hat p rocess.
Norma lly, the primary g roup of a newly created user is a newly created g roup
with the same
name as the user. The user is the only member of this User Private Group (U PG).
Most operating systems have some sort of superuser, a user that has all power over
the system.
This user in Red Hat Enterprise Linux is the root user. This user has the power to
override
normal privileges on the file system, and is used to manage and administer the
system.
echo $path
echo $home
echo $path
tail -5 /var/log/messages
tail -5 /var/log/messages
sudo tail -5 /var/log/messages
cp /etc/motd /etc/motld
cp /etc/motd /etc/motld
userdel username
useradd prince
useradd prince
ls -l /home
passwd student
UID 0 is always assigned to the superuser accou nt, root.
UID 1 -200 is a ra nge of "system users" assigned statica l ly to system processes
by Red Hat.
UID 201 -999 is a ra nge of "system users" used by system processes that do not own
files on
the file system. They a re typica lly assigned dynamically from the available pool
when the
softwa re that needs them is insta l led.
The -r option wi ll create a system g roup using a GID from the ra nge of va lid
system GID
numbe rs l isted in the /etc/login.defs file.
The groupmod command is used to cha nge a group name to a GID mapping. The -n
option is
used to specify a new name.
sudo groupmod -n javapp appusers
sudo groupadd -n javaapp appusers
$1$gCjLa2/Z$6Pu0EK0AzfCjxjv2hoLOB/
1. 1: The hashing algorithm. The number 1 indicates an MD5 hash. The number 6
appears when
a SHA-512 hash is used.
2. gCjLa2/Z: The salt used to encrypt the hash. This is originally chosen at ra
ndom. The
salt and the unencrypted password a re combined and encrypted to c reate the
encrypted
password hash. The use of a salt prevents two users with the same password from
having
identica l entries in the /etc/shadow file.
3. 6Pu0EK0AzfCj xj v2hoLOB/: The encrypted hash.
When a user tries to log in, the system looks up the entry for the user in
/etc/shadow,
combines the salt for the user with the unencrypted password that was typed in, and
encrypts
them using the hashing algorithm specified. If the res u lt matches the encrypted
hash, the user
typed in the right password. If the res u lt doesn't match the encrypted hash, the
user typed in the
wrong password and the login attempt fa i l s. This method a l lows the system to
determine if the
user typed in the correct password without storing that password in a form usable
for logging in.
chage -d 0
chage -d 0
chage -d 0
chage -l username
chage -l username
chage -E 2022-07-24
chage -E 2022-07-24