Linux Essential Commands
Linux Essential Commands
fb.com/AamirPingerOfficial github.com/AamirPinger
linkedin.com/in/AamirPinger
LINUX ESSENTIAL COMMANDS
the tilde (~) sign signifies the user’s home dir – change dir
cd ~
to home director
The find command is a powerful tool that you can use when
searching using the command line. The command here will
find / -name “linux*”
search for any file or directory with a name that starts with
linux
2
LINUX ESSENTIAL COMMANDS
cat /proc/cpuinfo This is a file that contains more information than the one
displayed using the lscpu command
Keys to
Purpose Example
Use
3
LINUX ESSENTIAL COMMANDS
commands $ alias
$ ln -s [file] [soft-link-to-
Create links to files and
ln file]
directories
$ ln -s abc.txt newAbc.txt
$ dd conv=ucase
Type Hello world ctrl+d
$ echo “hello world > abc.txt
dd Copy lines of data
$ dd if=abc.txt of=newabc.txt
conv=ucase
$ cat newabc.txt
4
LINUX ESSENTIAL COMMANDS
$ cut -b 1 abc.txt
cut Get sections of text in a file $ cut -b 1-3 abc.txt
$ cut -b 1,3 abc.txt
$ split abc.txt
$ ls
Specify a size to break a file $ rm x*
split
into -l100 is 100 lines per file
$ split -l100 abc.txt
$ ls
5
LINUX ESSENTIAL COMMANDS
$ echo “Karachi
Karachi
Lahore
Islamabad
Keep unique lines in a file and Islamabad
uniq
delete duplicates Lahore” > abc.txt
$ cat abc.txt
$ uniq abc.txt
$ uniq abc.txt -c
$ uniq abc.txt -d
compre
Use to compress a file $ compress -v abc.txt
ss
gzip Compress files with GNU Zip $ gzip -c abc.txt > abc.zip
$ cal
Show the calendar for the $ cal -3
cal
specified month or year $ cal -m 5
$ cal -y 2020
$ date
Show/Set the current date and
date Sets the system date and time to given
time
date
6
LINUX ESSENTIAL COMMANDS
shutdow
Turn off computer $ shutdown
n
aamir@ap-linux:~$ su
Password:
root@ap-linux:/home/aamir#
7
LINUX ESSENTIAL COMMANDS
root@ap-linux:/home/aamir# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ap-linux:/home/aamir#
8
LINUX ESSENTIAL COMMANDS
● For example, let’s create a group named office. To create this group,
● A user and group account owns a Linux file or directory. To see the owner
of a particular file
aamir@ap-linux:~$ ls -l <filename>
● To change the ownership of any file from one user to another user