linux_admin newest project
linux_admin newest project
Community :
Copyright : CC-BY-SA-NC
3
Table of Contents
#1 apt..................................................................................................................................................10
#2 apt-cache........................................................................................................................................12
#3 ar....................................................................................................................................................14
#4 add-apt-repository..........................................................................................................................16
#5 adduser...........................................................................................................................................17
#6 useradd...........................................................................................................................................18
#7 groupadd........................................................................................................................................21
#8 add group.......................................................................................................................................22
#9 alias................................................................................................................................................23
#10 unalias..........................................................................................................................................24
#11 apg................................................................................................................................................25
#12 apropos........................................................................................................................................26
#13 arch..............................................................................................................................................27
#14 badblocks.....................................................................................................................................28
#15 bg.................................................................................................................................................30
#16 blkid.............................................................................................................................................31
#17 bluetoothctl..................................................................................................................................32
#18 brctl..............................................................................................................................................34
#19 bunzip2........................................................................................................................................36
#20 bzcat.............................................................................................................................................37
#21 bzip2recover................................................................................................................................38
#22 blkdeactivate................................................................................................................................39
#23 bc.................................................................................................................................................40
#24 baobab..........................................................................................................................................42
#25 apparmor......................................................................................................................................43
#26 aa-enabled....................................................................................................................................44
#27 aa-remove-unknown....................................................................................................................45
#28 aa-status.......................................................................................................................................46
#29 aa-teardown.................................................................................................................................47
#30 bzdiff............................................................................................................................................48
#31 bzcmp..........................................................................................................................................49
#32 bzgrep..........................................................................................................................................50
#33 bzless...........................................................................................................................................51
#34 bzmore.........................................................................................................................................52
#35 chattr............................................................................................................................................53
#36 cancel...........................................................................................................................................55
#37 cat................................................................................................................................................56
#38 cd.................................................................................................................................................58
#39 cfdsik...........................................................................................................................................60
#40 chacl.............................................................................................................................................61
#41 chage............................................................................................................................................62
#42 check-bios-nx..............................................................................................................................64
#43 check-language-support...............................................................................................................65
#44 cheese..........................................................................................................................................66
#45 cal................................................................................................................................................67
#46 chfn..............................................................................................................................................68
#47 chgrp............................................................................................................................................70
#48 chmem.........................................................................................................................................72
4
#99 ed...............................................................................................................................................139
#100 egrep........................................................................................................................................142
#101 eject..........................................................................................................................................144
#102 env...........................................................................................................................................145
#103 evince.......................................................................................................................................146
#104 faillog.......................................................................................................................................147
#105 factor........................................................................................................................................148
#106 fakeroot....................................................................................................................................149
#107 fallocate...................................................................................................................................150
#108 fc..............................................................................................................................................151
#109 fc-list........................................................................................................................................153
#110 fdisk.........................................................................................................................................154
#111 fgrep.........................................................................................................................................155
#112 fg..............................................................................................................................................156
#113 file............................................................................................................................................157
#114 find...........................................................................................................................................159
#115 finger........................................................................................................................................160
#116 findfs........................................................................................................................................161
#117 findmnt.....................................................................................................................................162
#118 firefox......................................................................................................................................163
#119 fmt............................................................................................................................................164
#120 fold...........................................................................................................................................165
#121 for............................................................................................................................................166
#122 free...........................................................................................................................................167
#123 fsck..........................................................................................................................................168
#124 fsck.ext4...................................................................................................................................169
#125 ftp.............................................................................................................................................171
#126 funzip.......................................................................................................................................173
#127 fuser.........................................................................................................................................174
#128 getent.......................................................................................................................................175
#129 getfacl......................................................................................................................................176
#130 gpasswd...................................................................................................................................178
#131 groupadd..................................................................................................................................179
#132 groupdel...................................................................................................................................180
#133 groupmod.................................................................................................................................181
#134 gpg...........................................................................................................................................182
#135 gpg-zip.....................................................................................................................................184
#136 gzip..........................................................................................................................................185
#137 groupmems..............................................................................................................................188
#138 grep..........................................................................................................................................189
#139 groups......................................................................................................................................192
#140 gcc............................................................................................................................................193
#141 gawk........................................................................................................................................194
#142 gunzip......................................................................................................................................196
#143 halt...........................................................................................................................................197
#144 history......................................................................................................................................198
#145 hash..........................................................................................................................................200
#146 hd.............................................................................................................................................201
#147 head..........................................................................................................................................203
#148 hdparm.....................................................................................................................................205
6
#149 help..........................................................................................................................................206
#150 host..........................................................................................................................................207
#151 hostid.......................................................................................................................................209
#152 hostnamectl..............................................................................................................................210
#153 hostname..................................................................................................................................211
#154 hwclock....................................................................................................................................213
#155 hwe-support-status...................................................................................................................215
#156 id..............................................................................................................................................216
#157 ifconfig....................................................................................................................................217
#158 import......................................................................................................................................220
#159 info...........................................................................................................................................221
#160 init............................................................................................................................................222
#161 insmod.....................................................................................................................................223
#162 install.......................................................................................................................................224
#163 ip..............................................................................................................................................225
#164 iptables.....................................................................................................................................227
#165 isoinfo......................................................................................................................................229
#166 isosize......................................................................................................................................230
#167 iwconfig...................................................................................................................................231
#168 iwlist........................................................................................................................................232
#169 jobs..........................................................................................................................................233
#170 journalctl..................................................................................................................................235
#171 join...........................................................................................................................................236
#172 kill............................................................................................................................................237
#173 killall........................................................................................................................................239
#174 kmod........................................................................................................................................240
#175 last............................................................................................................................................241
#176 lastlog......................................................................................................................................242
#177 lastb..........................................................................................................................................243
#178 ldd............................................................................................................................................244
#179 link...........................................................................................................................................245
#180 less...........................................................................................................................................246
#181 ln..............................................................................................................................................247
#182 locale........................................................................................................................................248
#183 localectl....................................................................................................................................249
#184 logger.......................................................................................................................................250
#185 login.........................................................................................................................................252
#186 loginctl.....................................................................................................................................253
#187 logname...................................................................................................................................254
#188 logout.......................................................................................................................................255
#189 logrotate...................................................................................................................................256
#190 logsave.....................................................................................................................................257
#191 look..........................................................................................................................................258
#192 lsattr.........................................................................................................................................260
#193 ls..............................................................................................................................................262
#194 lshw..........................................................................................................................................264
#195 lsb_release...............................................................................................................................266
#196 lscpu.........................................................................................................................................267
#197 lsblk.........................................................................................................................................269
#198 lspci..........................................................................................................................................271
7
#199 lsof...........................................................................................................................................273
#200 lslocks......................................................................................................................................275
#201 lsmem......................................................................................................................................276
#202 lsns...........................................................................................................................................278
#203 lsinitramfs................................................................................................................................281
#204 lsipc..........................................................................................................................................282
#205 lslogins.....................................................................................................................................284
#206 lsmod.......................................................................................................................................287
#207 lsusb.........................................................................................................................................288
#208 man..........................................................................................................................................289
#209 mandb......................................................................................................................................291
#210 manpath...................................................................................................................................292
#211 md5sum....................................................................................................................................293
#212 mesg.........................................................................................................................................295
#213 mkdir........................................................................................................................................296
#214 mkswap....................................................................................................................................297
#215 modinfo....................................................................................................................................298
#216 modprobe.................................................................................................................................300
#217 mke2fs.....................................................................................................................................302
#218 mkfs.ext4.................................................................................................................................304
#219 mkfs.ntfs / mkfs.vfat................................................................................................................305
#220 mkinitramfs..............................................................................................................................306
#221 mkisofs....................................................................................................................................307
#222 more.........................................................................................................................................308
#223 mount.......................................................................................................................................310
#224 mdadm.....................................................................................................................................312
#225 mv............................................................................................................................................315
#226 nice..........................................................................................................................................317
#227 nmap........................................................................................................................................318
#228 networkctl................................................................................................................................321
#229 netstat.......................................................................................................................................323
#230 nisdomainname........................................................................................................................326
#231 nano.........................................................................................................................................328
#232 nmcli........................................................................................................................................332
#233 nl..............................................................................................................................................334
#234 netcat........................................................................................................................................336
#235 newgrp.....................................................................................................................................337
#236 newusers..................................................................................................................................338
#237 nohup.......................................................................................................................................339
#238 nproc........................................................................................................................................340
#239 nslookup..................................................................................................................................341
#240 nstat..........................................................................................................................................342
#241 on_ac_power............................................................................................................................343
#242 openssl.....................................................................................................................................344
#243 od.............................................................................................................................................346
#244 banner......................................................................................................................................348
#245 parted.......................................................................................................................................349
#246 partprobe..................................................................................................................................351
#247 partx.........................................................................................................................................352
#248 passwd.....................................................................................................................................353
8
#249 paste.........................................................................................................................................355
#250 patch........................................................................................................................................357
#251 pdf2ps......................................................................................................................................359
#252 pdffonts....................................................................................................................................360
#253 pdfinfo.....................................................................................................................................361
#254 pdftotext...................................................................................................................................362
#255 pgrep........................................................................................................................................363
#256 pidgin.......................................................................................................................................365
#257 pidof.........................................................................................................................................366
#258 ping..........................................................................................................................................367
#259 pip , pip3..................................................................................................................................369
#260 pkcon.......................................................................................................................................372
#261 pkexec......................................................................................................................................374
#262 pkg-config................................................................................................................................375
#263 grpck........................................................................................................................................376
#264 pkill..........................................................................................................................................377
#265 pmap........................................................................................................................................379
#266 popd.........................................................................................................................................381
#267 poweroff...................................................................................................................................383
#268 pr..............................................................................................................................................384
#269 printf........................................................................................................................................386
#270 printenv....................................................................................................................................387
#271 prtstat.......................................................................................................................................388
#272 ps..............................................................................................................................................389
#273 pstree........................................................................................................................................392
#274 ps2pdf......................................................................................................................................394
#275 pvck.........................................................................................................................................395
#276 pwconv....................................................................................................................................396
#277 pwd..........................................................................................................................................397
#278 pwdx........................................................................................................................................398
#279 qemu-img.................................................................................................................................399
#280 rcp............................................................................................................................................402
#281 renice.......................................................................................................................................403
#282 reboot.......................................................................................................................................404
#283 realpath....................................................................................................................................406
#284 rev............................................................................................................................................407
#285 replace......................................................................................................................................408
#286 reset..........................................................................................................................................409
#287 resize2fs...................................................................................................................................410
#288 resizepart..................................................................................................................................411
#289 return........................................................................................................................................412
#290 rfkill.........................................................................................................................................413
#291 rlogin........................................................................................................................................415
#292 rm.............................................................................................................................................416
#293 rmdir........................................................................................................................................418
#294 rmmod......................................................................................................................................419
#295 route.........................................................................................................................................420
#296 rsh............................................................................................................................................422
#297 rsync........................................................................................................................................423
#298 rsyslogd....................................................................................................................................426
9
#299 runlevel....................................................................................................................................428
#300 runuser.....................................................................................................................................429
10
#1 apt
apt - command line interface for Ubuntu and Debian based systems
apt provides a high-level command line interface for the package
management system
To install packages
$ sudo apt install package_name
To Upgrade System
$ sudo apt upgrade
To Remove Packages
$ sudo apt remove package_name
To List Packages
$ sudo apt list
12
#2 apt-cache
apt-cache - query the APT cache for debian and ubuntu based system
Examples:
To find and list down all the packages starting with apache2
$ sudo apt-cache pkgnames apache2
#3 ar
#4 add-apt-repository
#5 adduser
#6 useradd
To verify
$ id klug
19
$ id ilugc
To verify
$ sudo chage -l klug
#7 groupadd
#8 add group
#9 alias
#10 unalias
To check
$ sudo alias -p
$ sudo unalias d
#11 apg
$ apg -h
$ apg -n 2 -m 8 -x 10
-n number of passwords
#12 apropos
example:
$ apropos useradd
$ apropos adduser
$ apropos df
$ apropos free
$ apropos command_name
27
#13 arch
$ arch
28
#14 badblocks
To view the badblocks search in verbose mode i.e how much scanning
it has done so far
$ sudo badblocks -v /dev/sda1
To test blocks from the first block to the specified last block
$ sudo badblocks -s /dev/sda1 2000
#15 bg
$ ping google.com
press CTRL+Z
$ jobs -l
$ bg %1
or
$ kill -s stop 1
or
or
$ kill -9 73192
31
#16 blkid
#17 bluetoothctl
To untrust a device
33
#18 brctl
#19 bunzip2
$ bzip2 -z input.txt
$ bzip2 -d input.txt.bz2
To compress file input.txt but does not deletes the original file
$ bzip2 -k input.txt
$ bzip2 -t input.txt.bz2
$ bzip2 -v input.txt
37
#20 bzcat
example:
$ bzip2 number.txt
$ bzcat number.txt.bz2
38
#21 bzip2recover
example:
$ bzip2recover file_name
$ bzip2recover archive.tar.bz2
39
#22 blkdeactivate
$ sudo blkdeactivate
$ sudo blkdeactivate -u
40
#23 bc
$ echo "12+5" | bc
$ echo "10^2" | bc
$ echo $x
$ echo "var=10;var" | bc
$ echo "var=10;var^=2;var" | bc
$ echo $x
$ echo "var=11;++var" | bc
$ echo "var=20;var++" | bc
$ echo "var=20;--var" | bc
$ echo "var=10;var--" | bc
#24 baobab
$ baobab
$ baobab /dev/
43
#25 apparmor
$ sudo apparmor_status
44
#26 aa-enabled
#27 aa-remove-unknown
#28 aa-status
#29 aa-teardown
#30 bzdiff
examples:
To output a normal diff
$ bzdiff --normal file1.bz2 file2.bz2
#31 bzcmp
example:
#32 bzgrep
example:
#33 bzless
example:
$ echo "for(i=1; i<=10000; i++) {i;}" | bc > number.txt
$ bzip2 number.txt
$ bzless number.txt.bz2
52
#34 bzmore
example:
$ bzip2 number.txt
$ bzmore number.txt.bz2
53
#35 chattr
To open the file only in append mode and the previous data cannot
be modified
create a text file example.txt
$ sudo chattr +a example.txt
$ lsattr example.txt
-----a--------e----- example.txt
To unset it
$ sudo chattr -R -i important_folder
55
#36 cancel
examples:
$ cancel
$ cancel -a
$ cancel printer-1
$ cancel laser-100
To cancel all the print jobs that are queued for the user klug
$ cancel -u klug
56
#37 cat
example:
To display contents of file
$ cat /etc/group
#38 cd
cd - change directory
example:
$ cd /usr/share/
$ cd -
$ cd ..
$ cd --
$ cd ../ ../
$ cd ~
59
$ pushd /etc/perl/Net/
/etc/perl/Net ~
$ popd
60
#39 cfdsik
example:
$ sudo cfdisk
#40 chacl
example:
$ chacl -R file
$ chacl -D /directory_name
$ chacl -B file
$ chacl -l file/directory
#41 chage
example:
$ chage -h
$ chage -l user_name
$ chage -M 90 user_name
$ chage -W 7 user_name
63
$ chage -I 10 user_name
64
#42 check-bios-nx
#43 check-language-support
$ check-language-support --show-installed
$ check-language-support -a
66
#44 cheese
$ cheese -f
Start in wide mode, with the thumbnails to the right of the video
preview
$ cheese -w
$ cheese --device=DEVICE
67
#45 cal
example:
$ cal
$ cal -y
$ cal 2010
$ cal -3
68
#46 chfn
$ chfn
Password:
#47 chgrp
#48 chmem
$ sudo chmem -e 2g
offline
$ chmem -b -d 10
73
Symbolic Method
u - The file owner.
g - The users who are members of the group.
o - All other users.
a - All users, equal to ugo.
r - read
w - write
x - execute
To set Recursively remove the write permission for other users and
group
$ chmod -R o-w,g-w dir_name
75
numeric method
r (read) = 4
w (write) = 2
x (execute) = 1
no permissions = 0
rwx=4+2+1=7
rw= 4+2=6
rx= 4+1=5
To set users read, write and execute permissions, read and execute
permissions to group members and no permissions to all other users
$ chmod 750 file_name
#51 chown
#52 chpasswd
$ sudo chpasswd
klug: p@ssword1
ilugc: p@ssword2
CTRL+D
klug: p@ssword1
ilugc: p@ssword2
then,
or
#53 chsh
$ chsh
Password: *****
$ echo $SHELL
/bin/sh
$ chsh -s /bin/bash
$ echo $SHELL
/bin/bash
81
#54 cksum
CRC is unique for each file and only changes if the file is edited
$ cksum file.txt
2410262730 15 file.txt
$ cksum file.txt
2410262730 15 file.txt
#55 clear
$ clear
or
CTRL+l
or
$ reset
or
$ printf "\033c"
83
#56 cmp
To print byte position and byte value for all differing bytes
#57 colrm
$ cat number.txt
123456789
123789
456789
#58 column
$ column employee.txt
$ column -t employee.txt
$ column -x employee.txt
86
#59 comm
$ cat file1.txt
D1
D2
S1
S2
X1
$ cat file2.txt
D1
D2
S1
Z1
#60 compgen
$ compgen -c
$ compgen -c | wc -l
$ compgen -a
$ compgen -b
$ compgen -k
$ compgen -A function
89
#61 convert
#62 cpio
#63 cp
$ cp file_name /opt/
$ cp -i file_name /opt
$ cp -v file_name /opt
$ cp -r /home/klug /opt/backup
$ cp -a /home/klug /opt/backup/
To copy only when source file is newer than the target file
$ cp -v -u file_*.txt /opt/backup/
92
$ cp -s /home/klug/file1.txt /opt/backup/
$ cp -l /home/klug/file.txt /opt/backup/
$ cp -p file.txt /opt/backup/
$ cp -f file.txt /opt/backup
93
#64 cracklib-check
or
$ cracklib-check<<<"Wsd234$#@"
94
#65 crontab
$ crontab -l
$ crontab -e
$ crontab -u ilugc -l
$ crontab -r
$ crontab -i -r
$ crontab -e
00 09 * * * /home/ilugc/mycode.sh
95
$ crontab -e
* * * * * >/dev/null 2>&1
96
#66 ctrlaltdel
$ sudo ctrlaltdel
soft
hard
97
#67 csplit
$ cat file.txt
one
two
three
four
five
six
$ csplit file.txt 4
$ ls
$ cat abc00
$ cat abc01
98
#68 curl
$ curl https://www.ilugc.in
$ curl -# -O ftp://ftp.mysite.com/file.zip
$ curl -C - -O ftp://mysite.int/10000MB.zip
To limit the upper bound of the rate of data transfer and keeps it
around the given value in bytes.
#69 cut
$ cat file.txt
#70 dumpe2fs
#71 du
$ du /etc
$ du /home
$ du -h /etc
$ du -h /home/ilugc
$ du -sh /etc
$ du -ah /home/ilugc
$ du -ch /home/ilugc
$ du -BK /home/klug
$ du -BM /home/klug
102
$ du -BG /home/ilugc
$ du -h --max-depth=1 /home/ilugc
or
$ du -h -d1 /home/ilugc
$ du -h --exclude="*.py" /home/ilugc/Documents
$ du -s /home/ilugc/Documents
103
#72 dpkg-reconfigure
#73 dpkg-query
$ dpkg-query -s apache2
$ dpkg-query -L apache2
$ dpkg-query -l apache2
$ dpkg-query -W apache2
$ dpkg-query -S apache2
105
#74 dpkg
To install a package
$ sudo dpkg -l
To remove a package
#75 do-release-upgrade
$ do-release-upgrade
108
#76 domainname
$ domainame -a
$ domainname -A
$ domainame -d
$ domainname -i
$ domainname -I
$ domainname -s
$ domainname -y
109
#77 dmsetup
$ sudo dmsetup ls
#78 dmidecode
$ sudo dmidecode
$ sudo dmidecode -q
$ sudo dmidecode -t 3
112
$ sudo dmidecode -V
$ sudo dmidecode -t 6
$ sudo dmidecode -t 16
$ sudo dmidecode -t 17
$ sudo dmidecode -t 16
113
#79 dmesg
$ sudo dmesg -H
To check for hard disk and will display the messages wherever sda
is listed
#80 dirname
$ dirname /home/ilugc/myscript.sh
/home/ilugc
$ dirname -z /home/klug/autoscript.sh
/home/klug
116
#81 dir
$ dir -a
$ dir -A
$ dir -l --author
$ dir -1
$ dir -m
117
#82 dig
$ dig ilugc.in
The +trace option lists each different server the query goes
through to its final destination
$ dig -x yy.zz.aa.bb
yy.zz.aa.bb ip address
#83 date
$ date
$ date -u
$ date --date="1/04/2020"
May 07 2022
Apr 03 2022
$ date --file=datefile
$ date +%[format-option]
$ date "+%D"
$ date "+%Y/%m/%d"
$ date "+%Y-%m-%d"
121
#84 dd
$ dd if=/dev/sdc of=/dev/sdd
$ dd if=/dev/hdb of=~/hdbdisk.img
$ dd if=hdcdisk.img of=/dev/hdd
$ dd if=/tmp/sdbdisk.img of=/dev/sdb
$ cat file1
abcdefgh
$ cat file2
ABCDEFGH
#85 delgroup
#86 delpart
#87 deluser
#88 df
$ df -a
$ df -h /home/klug
$ df -h --total
$ df -T /home/ilugc
127
#89 diff
$ cat a.txt
Apple
Banana
Grapes
Mango
Papaya
$ cat b.txt
Apple
Banana
Grapes
Mango
To ignores case
#90 diff3
$ cat f1.txt
Hello
This is f1 file.
$ cat f2.txt
This is f2 file.
$ cat f3.txt
This is f3 file.
#91 e2fsck
To check a partition
or
#92 e2label
#93 e2mmpstatus
or
or
#94 e4defrag
or
$ sudo -v e4defrag /
134
#95 ebook-convert
#96 ebook-meta
$ ebook-meta my_book.pdf
$ ebook-meta my_book.pdf
#97 ebook-polish
#98 echo
$ echo [string]
WelcometoLinux
Welcome
Welcome
to
Linux
138
Welcome to Linux
to Linux
Welcome
to
Linux
$ echo *
139
#99 ed
Type ed
$ ed
$ ed
To view the last line enter “p” into the ed command prompt.
,p
f myfile.txt
140
To write the data into the file and see how many bytes are written
To summarize all
$ ed
,p
f myfile.txt
myfile.txt
53
Q
141
To check
$ cat myfile.txt
#100 egrep
$ cat myfile.txt
To count and print the number of lines that matched the pattern
and not the lines
myfile.txt
To Print only the names of the files that did not have the pattern
quite opposite to -l
myfile
$ egrep -r -i '.conf' .
. is current directory
To print each matched line along with the respective line numbers
To print only the matched parts of the line and not the entire
line for each match
#101 eject
#102 env
#103 evince
To open the document on the page with the specified page index
$ evince -i 5 your_book.pdf
#104 faillog
#105 factor
$ factor number
$ factor 1000
1000: 2 2 2 5 5 5
$ factor 10000
10000: 2 2 2 2 5 5 5 5
$ factor 30
30: 2 3 5
$ factor 300
300: 2 2 3 5 5
$ factor 10000000
10000000: 2 2 2 2 2 2 2 5 5 5 5 5 5 5
$ factor 17
17: 17
$ factor 19
19: 19
149
#106 fakeroot
$ fakeroot
# ls -l root.txt
# ls -l /root
# exit
$ ls -l root.txt
150
#107 fallocate
$ fallocate -l 2G file1.img
check with
$ ls -lh *.img
151
#108 fc
#109 fc-list
To print all the file locations of the font files present in the
system
$ fc-list
To print only the names of the font families which support the
tamil language code
$ fc-list : family lang=ta
154
#110 fdisk
#111 fgrep
#112 fg
$ ping ilugc.in
^Z
$ jobs -l
$ fg %1
157
#113 file
$ file -b filename.py
$ file -b file.img
$ file -b file.txt
$ file -b file.pdf
$ file *
$ file /my_home_dir/*
$ file [a-d]*
$ file [e-h]*
$ file -i filename.txt
158
$ file -z file.bz2
159
#114 find
#115 finger
finger - displays the user's login name, real name, terminal name
and write status , idle time, login time, office location and
office phone number
$ finger user_name
$ finger klug
$ finger -s ilugc
$ finger -p klug
161
#116 findfs
$ findfs LABEL=<label>
$ findfs LABEL=klug
$ findfs UUID=<uuid>
$ findfs UUID=cbbf8b34-7bf1-4dba-9eb0-59e85ade7083
/dev/sda5
$ findfs PARTUUID=<uuid>
$ findfs PARTLABEL=<label>
162
#117 findmnt
$ sudo findmnt
$ sudo findmnt -l
#118 firefox
$ type -a firefox
$ firefox
or
$ /usr/bin/firefox
$ /usr/bin/firefox --preferences
$ /usr/bin/firefox --setDefaultBrowser
164
#119 fmt
$ cat file.txt
Hai
all Welcome
to
ILUGC
$ fmt file.txt
$ fmt -s file.txt
To make one space between words and two spaces after sentences for
formatting
$ fmt -u file.txt
165
#120 fold
$ fold testfile.txt
#121 for
welcome 1 times
welcome 2 times
welcome 3 times
welcome 4 times
welcome 5 times
167
#122 free
$ free
$free -b
$free -k
$free -m
$free -g
$ free -t
$ free -s 4 -c 4
168
#123 fsck
$ fsck -AR
169
#124 fsck.ext4
#125 ftp
$ ftp xx.xx.xx.xx
To upload a file
or
#126 funzip
#127 fuser
$ fuser .
or
$ fuser /home/ilugc
$ fuser -v .
or
$ fuser -v /home/ilugc
$ fsuer -v -m /etc/profile
$ sudo fuser -k .
#128 getent
$ getent passwd
$ getent group
$ getent services 20
ftp-data 20/tcp
$ getent services 53
domain 53/tcp
$ getent services 22
ssh 22/tcp
mysql 3306/tcp
176
#129 getfacl
getfacl - getfacl displays the file name, owner, the group, and
the Access Control List (ACL)
example:
$ getfacl file_name
$ getfacl -a file.txt
$ getfacl -d file.txt
$ getfacl -e file.txt
$ getfacl -s file.txt
$ getfacl -R /dir_name
177
$ getfacl -t /home/ilugc/file.txt
$ getfacl -n file.txt
178
#130 gpasswd
#131 groupadd
#132 groupdel
#133 groupmod
#134 gpg
gpg - gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG).
It is a tool to provide digital encryption and signing services
using the OpenPGP standard
$ gpg --version
$ gpg --gen-key
$ gpg --list-keys
$ gpg -c helloworld.py
$ gpg -d helloworld.py.gpg
$ gpg --dump-options
184
#135 gpg-zip
#136 gzip
$ gzip file_name.txt
$ gzip -r *
$ gzip -d file_name.txt.gz
$ gzip -l file.tar.gz
186
$ gzip -l file.tar.gz
$ gzip -l file.tar.gz
$ gzip -L
$ gzip -q file.txt
$ gzip -N file.txt
188
#137 groupmems
user : ilugc
group : foss
or
#138 grep
$ cat grep_example.txt
this is line 4
This is line 5
this is line 4
this is line 4
190
this is line 4
This is line 5
$ grep -r "key_word" *
To find out how many lines that does not match the pattern
4:this is line 4
191
#139 groups
$ groups [username]
$ groups ilugc
ilugc : ilugc adm cdrom sudo dip plugdev lpadmin lxd sambashare
libvirt docker
$ groups
# groups
root
193
#140 gcc
$ gcc hello.c
#141 gawk
$ cat staff.txt
arun 0001
babu 0002
chandru 0003
dhana 0004
kiran 0005
raj 0006
sunil 0007
teja 0008
$ gawk '{ if (length($0) > max) max = length($0) } END { print max
}' staff.txt
#142 gunzip
$ gunzip file.gz
gunzip will remove the compressed file , to keep the original file
$ gunzip -k file.gz
$ gunzip -r directory
#143 halt
halt - used to instruct the hardware to stop all the CPU functions
$ sudo halt
$ sudo halt -p
$ sudo halt -w
#144 history
$ history
To show only the latest 10 entries from the list of commands used
since the start of the
terminal session
$ history 10
$ !100
$ !!
To run the command count starts the from the end of the list
for example to run the 3rd command in history count starts from
the end
$ !-3
199
$ !sudo
$ !sudo:p
To search for a command that contains a string but not start with
the string
$ !?firewall-cmd
$ history -d event_number
$ history -d 100
$ history -c
$ history | tail
200
#145 hash
$ hash
hits command
2 /usr/bin/man
2 /usr/bin/ls
1 /usr/bin/cat
$ hash -r
$ hash -l
$ hash -t cat ls
cat /usr/bin/cat
ls /usr/bin/ls
201
#146 hd
$ cat dummy.txt
$ hexdump -b dummy.txt
$ hexdump -c dummy.txt
$ hexdump -C dummy.txt
$ hexdump -d dummy.txt
$ hexdump -o dummy.txt
202
$ hexdump -x dummy.txt
$ hexdump -s 2 -c dummy.txt
$ hexdump -v -b dummy.txt
203
#147 head
$ head file.txt
$ head -n 6 file.txt
$ head -c 10 example1.txt
$ head -v file.txt
$ ls /etc | head
$ ls -t | head -n 4 | sort
205
#148 hdparm
$ sudo hdparm -h
#149 help
$ help help
$ help cd
$ help -d help
$ help -d ls
$ help -d cd
$ help -m help
$ help -m pwd
$ help -s pwd
$ help -s cd
207
#150 host
$ host ilugc.in
$ host 54.255.56.197
$ host -a ilugc.in
$ host -t ns ilugc.in
To specify the number of retries you can do in case one try fails
$ host -R 3 ilugc.in
209
#151 hostid
$ hostid
7c787dcd
210
#152 hostnamectl
$ hostnamectl
check with
$ hostnamectl
$ hostnamectl --help
211
#153 hostname
$ hostname
$ hostname -a
$ hostname -A
$ hostname -b
To get the domain name if local domains are set. It will not
return anything
$ hostname -d
To get the FQDN , It contains short hostname and DNS domain name
$ hostname -f
212
$ hostname -i
$ hostname -I
$ hostname -s
$ hostname -y
213
#154 hwclock
$ sudo hwclock
or
$ sudo hwclock -w
To get the output of the date command, and pass it to the --set
and --date option
#155 hwe-support-status
$ hwe-support-status
$ hwe-support-status -h
216
#156 id
$ id
$ id -u ilugc
$ id -g ilugc
$ id ilugc
$ id -G ilugc
$ id -nG ilugc
$ id -r -g ilugc
$ id -r -G ilugc
217
#157 ifconfig
$ sudo ifconfig -a
$ sudo ifconfig -s
$ sudo ifconfig -v
or
or
#158 import
#159 info
$ info -a ls
$ info -k cat
$ info -d ls
$ info -O du
$ info -w df
$ info --help
222
#160 init
$ init 6
$ init 0
223
#161 insmod
to check
$ dmesg | tail -1
or
$ dmesg | tail -2
or
#162 install
to check
$ ls data/
To copy the data from one location to another location with the
comparison
$ ls data/
To get help
$ install --help
225
#163 ip
$ sudo ip a
$ sudo ip -4 a
$ sudo ip -6 a
$ sudo ip link ls up
To check
#164 iptables
# iptables -L -n -v
# host twitter.com
CIDR: 104.244.40.0/21
# iptables -F
#165 isoinfo
$ isoinfo -i ubuntu-20.04-server-amd64.iso -l
#166 isosize
$ isosize Centos.iso
$ isosize -x Centos.iso
#167 iwconfig
$ iwconfig
To displays help
$ iwconfig --help
232
#168 iwlist
To list options
$ iwlist
To list authentication
#169 jobs
jobs - used to list the jobs that you are running in the
background and in the foreground
$ ping google.com
CTRL+Z
$ jobs
To display the process ID or jobs for the job whose name begins
with “p”
$ jobs %p
$ jobs -p
$ jobs -l
$ jobs -r
234
$ fg %1
235
#170 journalctl
$ journalctl -r
$ journalctl -n 4
$ journalctl -p debug
$ journalctl -p info
$ journalctl -u ntpd
$ journalctl -u ftpd
$ journalctl -o verbose
$ journalctl -n 3 -p debug
$ journalctl -n 4 -p info
236
#171 join
$ cat file1.txt
1 andhra
2 tamilnadu
3 kerala
4 karnataka
5 pondicherry
$ cat file2.txt
1 101
2 102
3 103
4 104
5 105
#172 kill
$ kill -l
$ kill pid
$ kill 9898
$ kill -9 7890
$ kill -l 3
$ kill -l 9
$ kill -l 15
$ kill -s
$ Kill -2 5656
$ kill -1 8181
239
#173 killall
$ killall example
To killall sshd
$ killall sshd
$ killall -9 sshd
$ killall -I Example
$ killall -l
#174 kmod
#175 last
$ last -5
$ last -R user_name
$ last -F
$ last -a
$ last -x
242
#176 lastlog
$ sudo lastlog
$ sudo lastlog -b 7
#177 lastb
$ sudo lastb
#178 ldd
$ ldd /bin/cp
$ ldd -v /bin/cp
$ ldd -u /bin/cp
$ ldd -u /bin/grep
245
#179 link
$ vim file1.txt
1 andhra
2 tamilnadu
3 kerala
4 karnataka
5 pondicherry
#180 less
$ less filename
$ dmesg | less
$ dmesg | less -N
$ less -s file_name
$ dmesg | less -X
247
#181 ln
$ ln sample_file.txt sample_link_file.txt
$ ln -s file.txt link_file.txt
$ ls -l link_file.txt
$ ln -s /home/ilugc/project ~/ilugc_project
$ ls -l ~/ilugc_project
#182 locale
$ locale
$ locale -k LC_TIME
$ locale -a
249
#183 localectl
#184 logger
view by
$ tail -1 /var/log/syslog
251
$ logger -e -f file1.txt
252
#185 login
# login
# login -p ilugc
To login to a domain
# login ilugc.in
To display help
# login --help
253
#186 loginctl
$ loginctl -a
$ loginctl show-session
$ loginctl list-users
#187 logname
#188 logout
To logout the user from the current session from logon shell
$ logout
256
#189 logrotate
To display help
#190 logsave
$ cat log_file.txt
$ cat log_file.txt
#191 look
$ cat words.txt
files
Files
fiction
fig
fix
find
Find
files
$ look fi words.txt
files
fiction
fig
fix
find
259
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
files
Files
$ look apple
$ look ban
$ look cat
files
Files
fiction
fig
fix
find
Find
260
#192 lsattr
$ lsattr
$ lsattr file.txt
$ lsattr -R /etc/ssh/
$ lsattr -v
$ lsattr -V
$ lsattr -a
$ lsattr -a ~
261
$ lsattr /etc/ssh/
$ lsattr -d /etc/ssh/
262
#193 ls
$ ls
$ ls -l
$ ls -a
$ ls -lh
$ ls -F
$ ls -r
$ ls -R
263
$ ls -lS
$ ls -i
$ ls -n
$ ls -lt
$ ls -ltr
/ - directory.
@ - link file.
* - Executable file
$ ls -F
264
#194 lshw
$ lshw
$ lshw -short
$ lshw -sanitize
$ lshw -html
265
$ lshw -xml
To get help
$ lshw --help
266
#195 lsb_release
$ lsb_release -a
$ lsb_release -i
$ lsb_release -d
$ lsb_release -r
$ lsb_release -c
267
#196 lscpu
$ lscpu
$ lscpu -e
$ lscpu -e=cpu
$ lscpu -p
$ lscpu -x
$ lscpu -J
$ lscpu --help
$ lscpu --bytes
268
$ lscpu -a -e
$ lscpu -a -p
$ lscpu --offline -p
$ lscpu --online -e
or
$ lscpu --online -p
$ lscpu -C
#197 lsblk
$ sudo lsblk
$ sudo lsblk -a
$ sudo lsblk -b
$ sudo lsblk -z
$ sudo lsblk -d
$ sudo lsblk -m
To display help
$ sudo lsblk -l
$ sudo lsblk -S
271
#198 lspci
$ sudo lspci
$ sudo lspci -m
$ sudo lspci -t
$ sudo lspci -v
$ sudo lspci -n
272
To show PCI vendor and device codes as both numbers and names
$ sudo lspci -k
$ sudo lspci -b
$ sudo lspci -D
273
#199 lsof
To list out all the files that are opened by any process in the
system
$ sudo lsof
$ sudo lsof -R
$ sudo lsof -i
274
$ lsof -i TCP:22
$ sudo lsof -i 4
$ sudo lsof -i 6
To list all the running processes of open files of TCP Port ranges
from 1-1024
$ sudo -i TCP:1-1024
#200 lslocks
$ sudo lslocks
$ sudo lslocks -b
$ sudo lslocks -J
To display only the locks held by the process with specific pid
#201 lsmem
#202 lsns
#203 lsinitramfs
#204 lsipc
#205 lslogins
To Display data about the date of last password change and the
account expiration date
$ sudo lslogins -a
To display help
$ lslogins --help
285
#206 lsmod
$ lsmod
Module Size Used by
#207 lsusb
#208 man
#209 mandb
$ sudo mandb
#210 manpath
#211 md5sum
$ cat example.txt
this is line one
this is line two
change the content of any one above file for eg. file2.txt and
check
To display only modified files
$ md5sum --quiet -c hashfile
295
#212 mesg
#213 mkdir
#214 mkswap
To check the device for bad blocks before creating the swap area
$ sudo mkswap -c /dev/sdb
To specify the page size (in bytes) to use, mkswap reads the size
from the kernel
$ sudo mkswap -p PAGESIZE
#215 modinfo
To print version
$ modinfo -V
#216 modprobe
#217 mke2fs
#218 mkfs.ext4
#220 mkinitramfs
#221 mkisofs
#222 more
#223 mount
syntax
$ mount -t type device dir
To mount an NFS
$ sudo mkdir /media/nfs
$ sudo mount /media/nfs
#224 mdadm
syntax
$ sudo mdadm [mode] <raiddevice> [options] <component-devices>
To print help
$ sudo mdadm --help
$ sudo mdadm --create --help
$ sudo mdadm --assemble --help
$ sudo mdadm --build --help
314
#225 mv
syntax:
$ mv [Option] source destination
#226 nice
#227 nmap
#228 networkctl
first check
$ sudo systemctl start systemd-networkd
$ sudo systemctl enable systemd-networkd
$ sudo systemctl status systemd-networkd
#229 netstat
#230 nisdomainname
#231 nano
To exit a file
press Ctrl+x
To do spell check
$ sudo apt install spell
press Ctrl+t
To go to end of paragraph
Ctrl + o
To go to first line
Ctrl + y
To go to last line
Ctrl + v
To cancel
Ctrl + c
To get help
Ctrl + g
To go to previous line
Ctrl + p
To go to next line
Ctrl + n
331
To go one screenful up
Ctrl + y
#232 nmcli
To reload connection
$ nmcli con reload
To activate a connection
$ nmcli con up eth0
To deactivate a connection
$ nmcli con down eth0
To delete connection
$ nmcli con del <interface_name>
334
#233 nl
$ cat file.txt
Apache
Squid
Samba
DNS
DHCP
#234 netcat
on sending server
$ nc -w 2 192.168.122.10 9899 < file.txt
337
#235 newgrp
$ newgrp ilugc
Attempts to log in to the group ilugc
#236 newusers
#237 nohup
create example.sh
$ sudo vim example.sh
#!/bin/bash
echo "hello!!!"
:x
#238 nproc
#239 nslookup
#240 nstat
To reset history
$ nstat -r
#241 on_ac_power
$ on_ac_power
0 (true) System is on mains power
1 (false) System is not on mains power
255 (false) Power status could not be determined
#242 openssl
#243 od
$ cat file.txt
This is test message1
This is test message2
This is test message3
To print help
$ od --help
#244 banner
To install banner
$ sudo apt install sysvbanner
syntax
$ banner text
$ banner 12345
$ banner ilugc
$ banner klug
By default it prints in Upper case letters only
It will print only alphanumeric not special characters.
349
#245 parted
#246 partprobe
#247 partx
#248 passwd
#249 paste
$ cat name
apache
nginx
mysql
ftp
jenkins
$ server
webserver
webserver
db server
file server
integration server
#250 patch
$ cat first.py
#!/usr/bin/python3
print ("hello ILUGC")
Check Difference
create a patch file named as myfile.patch
$ touch myfile.patch
To apply patch
$ patch < myfile.patch
358
#251 pdf2ps
#252 pdffonts
$ pdffonts input.pdf
$ pdffonts file.pdf
#253 pdfinfo
To print the undecoded date strings directly from the PDF file
$ pdfinfo -rawdates file.pdf
362
#254 pdftotext
syntax
$ pdftotext PDF-file text-file
#255 pgrep
syntax
$ pgrep [OPTIONS] <PATTERN>
To print help
$ pgrep --help
365
#256 pidgin
#257 pidof
syntax
$ pidof [OPTIONS] PROGRAM_NAME
To return only the PIDs of the processes that are running with the
same root directory
# pidof -c pid sshd
#258 ping
syntax
$ ping [option] [hostname] or [IP address]
To request IPv6
$ ping -6 hostname/IPv6
To request IPv4
$ ping -4 hostname/IPv4
To upgrade pip3
$ python -m pip3 install --upgrade pip
To downgrade pip3
$ python -m pip3 install pip==19.0
To uninstall packages
$ pip3 uninstall <package_name>
$ pip3 uninstall numpy
370
To search packages
$ pip3 search <package_name>
$ pip3 search numpy
To upgrade packages
$ pip3 install --user --upgrade package_name
$ pip3 install --user --upgrade numpy
To Downgrade packages
$ pip3 install --user package_name==version
$ pip3 install --user pip install numpy==1.22.2
To debug
$ python3 -m pip debug
372
#260 pkcon
#261 pkexec
$ pkexec <command>
$ pkexec pwd
$ pkexec ls
$ pkexec df
#262 pkg-config
To print errors
$ pkg-config openssl --print-errors
To list packages
$ pkg-config --list-all
#263 grpck
Exit Codes
0: Success.
1: Syntax error.
2: One or more bad group entries found.
3: Could not open group files.
4: Could not lock group files.
5: Could not write group files.
377
#264 pkill
syntax
$ pkill [OPTIONS] <PATTERN>
To send KILL signals to all processes under the user1 and patterns
matching X process
$ pkill -9 -u user1 X
#265 pmap
syntax
$ pmap [options] pid [...]
#266 popd
syntax
$ popd [OPTIONS] [DIRECTORY]
$ dirs -l -v
0 /home/ilugc/Templates
1 /home/ilugc/Pictures
2 /home/ilugc/Videos
3 /home/ilugc/Music
4 /home/ilugc/Downloads
5 /home/ilugc/Documents
6 /home/ilugc/Desktop
7 /home/ilugc
#267 poweroff
#268 pr
Syntax:
$ pr [options][filename]
To print help
$ pr -h
386
#269 printf
Syntax
$ printf [-v var] format [arguments]
#270 printenv
#271 prtstat
#272 ps
To display file system group, nice value, start time, and elapsed
time of a process.
$ ps -p 1154 -o pid,ppid,fgroup,ni,lstart,etime
#273 pstree
To show PIDs
$ pstree -p
#274 ps2pdf
$ ps2pdf sample.ps
$ ps2pdf file.ps file.pdf
To embed fonts
$ ps2pdf -dEmbedAllFonts=true sample.ps
#275 pvck
syntax
$ sudo pvck [options]
To print help
$ pvck -h
#276 pwconv
#277 pwd
#278 pwdx
syntax
$ pwdx pid
$ pwdx pid1 pid2 pid3
#279 qemu-img
syntax
$ qemu-img subcommand [options]
To get help
$ qemu-img -h
To list snapshots of VM
$ qemu-img snapshot -l ubuntu.qcow2
$ qemu-img snapshot -l centos.qcow2
To delete snapshot
$ qemu-img snapshot -d 1 ubuntu.qcow2
$ qemu-img snapshot -d 1 centos.qcow2
#280 rcp
syntax
$ rcp options source destination
To copy directories
$ rcp -r localdir remote_host:
#281 renice
#282 reboot
syntax
$ reboot [OPTIONS...]
To restart system
$ sudo reboot
$ sudo shutdown -r now
To cancel restart
$ sudo shutdown -c "message"
$ sudo shutdown -c "scheduled shutdown is cancelled"
#283 realpath
syntax
$ realpath /path/to/file
$ ls -l /etc/os-release
$ realpath /etc/os-release
#284 rev
$ vim file.txt
This is sample test file
:x
$ rev file.txt
$ rev
linux
foss
ilugc
#285 replace
$ cat example.txt
This is paragraph one
This is paragraph two
This is paragraph three
#286 reset
#287 resize2fs
syntax
$ resize2fs [options] {device/file system name} [desired size]
#288 resizepart
$ sudo parted
(parted) resizepart
Partition number? 2
End? [20.0GB]? 30000
#289 return
syntax
$ return [N]
#290 rfkill
To Block an interface by ID
$ sudo rfkill block 0
$ sudo rfkill block 1
To unblocking interfaces
$ sudo rfkill unblock 0
#291 rlogin
#292 rm
#293 rmdir
#294 rmmod
syntax
$ rmmod [options] module_name
To remove a module
$ rmmod bluetooth
$ rmmod ath10k_core
#295 route
#296 rsh
syntax
$ rsh remote-machinename/ip command
#297 rsync
syntax
$ rsync options SOURCE DESTINATION
#298 rsyslogd
To Turn on Debugging
$ sudo rsyslogd -d
To do a config check
$ sudo rsyslogd -N 1
428
#299 runlevel
0 - Halt
1 - Single-user mode
2 - Not used (user-definable)
3 - Full multi-user mode
4 - Not used (user-definable)
5 - Full multi-user mode (with an X-based login screen)
6 - Reboot
#300 runuser
Syntax:
# runuser - username -c [commands...]