Basic+Linux+Commands
Basic+Linux+Commands
Dear students,
https://www.udemy.com/course/the-ultimate-ethical-hacking-
masterclass/?referralCode=04396DED9904CEE40EC9
mv Renames a directory
Divides the file into x
pr -x
columns
pr -h Assigns a header to the file
Denotes the file with Line
pr -n
Numbers
lp -nc , lpr c Prints “c” copies of the File
lp-d lp-P Specifies name of the printer
Command used to install and
apt-get
update packages
mail -s 'subject'
-c 'cc-address'
Command to send email
-b 'bcc-address'
'to-address'
mail -s "Subject" Command to send email with
to-address < Filename attachment
Command Description
Lists all files and
ls directories in the present
working directory
Lists files in sub-directories
ls -R
as well
ls -a Lists hidden files as well
https://Neamatullah.com Neamatullah Ekhteyari
Command Description
echo $VARIABLE To display value of a variable
Displays all environment
env
variables
VARIABLE_NAME=
Create a new variable
variable_value
Unset Remove a variable
To set value of an environment
export Variable=value
variable
User management commands of linux
Command Description
sudo adduser username To add a new user
To change the password of a
sudo passwd -l 'username'
user
sudo userdel -r
To remove a newly created user
'username'
https://Neamatullah.com Neamatullah Ekhteyari
sudo usermod -a -G
To add a user to a group
GROUPNAME USERNAME
sudo deluser USER
To remove a user from a group
GROUPNAME
Shows information of all the
finger
users logged in
Gives information of a
finger username
particular user
Networking command
Command Description
SSH username@ip-address login into a remote Linux
or hostname machine using SSH
To ping and Analyzing network
Ping hostname="" or =""
and host connections
Display files in the current
dir
directory of a remote computer
change directory to “dirname”
cd "dirname"
on a remote computer
upload ‘file’ from local to
put file
remote computer
Download ‘file’ from remote to
get file
local computer
https://Neamatullah.com Neamatullah Ekhteyari
quit Logout
Process command
Command Description
To send a process to the
bg
background
To run a stopped process in
fg
the foreground
Details on all Active
top
Processes
Give the status of processes
ps
running for a user
Gives the status of a
ps PID
particular process
Gives the Process ID (PID) of
pidof
a process
kill PID Kills a process
Starts a process with a given
nice
priority
Changes priority of an already
renice
running process
Gives free hard disk space on
df
your system
https://Neamatullah.com Neamatullah Ekhteyari
Vi editing commands
Command Description
Insert at cursor (goes into
i
insert mode)
Write after cursor (goes into
a
insert mode)
Write at the end of line (goes
A
into insert mode)
ESC Terminate insert mode
u Undo last change
Undo all changes to the entire
U
line
Open a new line (goes into
o
insert mode)
dd Delete line
3dd Delete 3 lines
Delete contents of line after
D
the cursor
Delete contents of a line
after the cursor and insert
C
new text. Press ESC key to end
insertion.
dw Delete word
https://Neamatullah.com Neamatullah Ekhteyari
https://www.udemy.com/course/the-ultimate-ethical-hacking-
masterclass/?referralCode=04396DED9904CEE40EC9
https://www.udemy.com/course/python-project-
masterclass/?referralCode=0DBF917BCBA6F262B7D7
https://www.udemy.com/course/mastering-python-automation-for-every-
day-life/?referralCode=C9492B65364B02709639
https://Neamatullah.com Neamatullah Ekhteyari