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 directory
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]
Create links to files and
ln [soft-link-to-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
Lahore
Islamabad
Islamabad
Lahore” > abc.txt
$ cat abc.txt
$ uniq abc.txt
$ uniq abc.txt -c
$ uniq abc.txt -d
$ 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 Sets the system date and time to given
date
time date
$ date -s "11/20/2003 12:48:00"
6
LINUX ESSENTIAL COMMANDS
processes
shutdo
Turn off computer $ shutdown
wn
aamir@ap-linux:~$ su
Password:
root@ap-linux:/home/aamir#
● Add user by using following command syntax
root@ap-linux:/home/aamir# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ap-linux:/home/aamir#
7
LINUX ESSENTIAL COMMANDS
● For example, let’s create a group named office. To create this group,
aamir@ap-linux:~$ ls -l <filename>
● To change the ownership of any file from one user to another user
8