Command Line Fundamentals

can not survive without knowing these basic commands

print working directory ; where am I ?

pwd

which user i am currently logged in with

whoami

change directory

cd

go up one directory / go back one directory

cd .. 

jump to home dir

cd ~ 

go to last directory

cd - 

[ concept of absolute path and relative path ]

ls 
ls /etc/
ls kali/shark

security

mkdir 

security

rmdir 

to delete recursively

rm -r shark

ls  -la

create a file named as hi.txt and put contents inside quotes inside it

echo "hello" > hi.txt 
cp srcfile dstfile
mv src dst

mv used to rename files as well

mv 

is c opy paste

cp

is cut paste

mv 

shark.txt looks / search eerywhere for specific file name

locate 

updatedb

to change password by default of logged in users

passwd 

passwd shark tochange passwrd of shark nameduser account

to read file contents ; cat means to concat

cat file1.txt 

Linux file permissions

rwx rwx rwx

r ->4 w-> 2 x->1

chmod +r file1.txt
chmod 777 file1.txt 

to add new user named shark

adduser shark

Import files :

does not stores password ; only stores users n account information

/etc/passwd 

stores password in hasehd format look into details of both files

/etc/shadow 

Last updated

Was this helpful?