0% found this document useful (0 votes)
27 views45 pages

Linux Basic Commands

Linux commands

Uploaded by

SBV FOR WORLD
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
27 views45 pages

Linux Basic Commands

Linux commands

Uploaded by

SBV FOR WORLD
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 45

MPRASHANT

LINUX
100+ COMMANDS
Get Ready with your Linux
Setup for Practise
MPRASHANT

How to check your current


location?

#pwd

1
MPRASHANT

How to display name of current


logged-in user?

#whoami
2
MPRASHANT

How to check system date or


time?

#date
#date %D
3
MPRASHANT

How to display files and directory


present in current location?

#ls
#ls -lt
4
MPRASHANT

How to clear the linux terminal?

#clear

5
Creating
Deleting
Editing.
MPRASHANT

How to display content of a file


on terminal?

#cat <file>

6
MPRASHANT

How to read a file and Search for a


word?

#less <file>

7
MPRASHANT

How to view content of a file page


by page?

#more <file>

8
MPRASHANT

How to create a file in Linux?

#touch <file_name>

9
MPRASHANT

How to delete a file in Linux?

#rm <file_name>

10
MPRASHANT

How to edit a file in Linux?

#vi <file_name>
#nano <file_name>
11,12
MPRASHANT

How to create a
directory/folder in Linux?

#mkdir <dir_name>

13
MPRASHANT

How to delete a
directory/folder in Linux?

#rmdir <dir_name>

14,15 #rm -rf <dir_name>


MPRASHANT

How to change path or move


to another folder in Linux?

#cd /path/folder

16 #cd ..
MPRASHANT

How to copy and paste a file from


one folder to another in Linux?

#cp <file> /dest/path

17
MPRASHANT

How to copy content of a file to


another file in Linux?

#cp fileA fileB

18
MPRASHANT

How to cut - paste a file from one


folder to another in Linux?

#mv <file> /dest/path

19
MPRASHANT

How to rename a file in Linux?

#mv fileA fileNewName

19
MPRASHANT

How to read or diplay top 5 lines


from a file in Linux?

#head -5 file

20
MPRASHANT

How to read or diplay bottom 5


lines from a file in Linux?

#tail -5 file

21
MPRASHANT

How to SORT the content from a


file in Linux?

#sort file
#sort -r file
22
MPRASHANT

How to display UNIQUE content


from a file in Linux?

#sort file | uniq

23
MPRASHANT

A file has 9 lines.


How to split this file in 3 different
files in Linux?

#split -l 3 file
24
MPRASHANT

How to search a word and display


matching content from a file in
Linux?

#grep "word" file

25
MPRASHANT

How to search multiple words and


display matching content from a
file in Linux?

#egrep "word1|word2" file

26
MPRASHANT

How to use WILDCARDS in Linux?


* [] {}

#ls file*
#touch file{1..5}
27
MPRASHANT

How to SHUFFLE content of file in


Linux?

#shuf file

28
MPRASHANT

How to COUNT no. of lines in a


file in Linux?

#wc -l file
29
MPRASHANT

How to check if two files are


identical or not in Linux?

#cmp fileA fileB

30
MPRASHANT

How to compare and display


difference between two files in
Linux?

#diff -u fileA fileB

31
MPRASHANT

How to find a file in Linux?

#find /path/ -name <file>

32
MPRASHANT

How to find a file in Linux?

#updatedb
#locate <file>
33,34
Utility Commands
MPRASHANT

How to display previously used


commands in past?

#history

35
MPRASHANT

How to check syntax and options


available for a command?

#help

36
MPRASHANT

How to read or get mor info about


a command?

#man

37
MPRASHANT

How to check which executable is


using for a command?

#which

38
MPRASHANT

How to use calculator in Linux?

#bc

39
MPRASHANT

How to check CALENDAR of last


year in Linux?

#cal

40
MPRASHANT

How to check How Long server


has been running in Linux?

#uptime

41
MPRASHANT

How to record your activity on


termial in a file?

#script

42
MPRASHANT

How to create a short-cut of a


long command in Linux?

#alias l="ls -ltr"

43

You might also like