Wednesday, 31 July 2019

Linux commands

-------------------- pwd / cd --------------------------------

pwd - print working directory
cd - change directory
cd / - move to root directory
cd ~ - home directory
cd dir1/dir2 - move to said directory
cd .. -fall back one directory

------------------------ LS---------------------------------
ls - displays files and folders in the currect directlory

ls-R - displays files and folders in the currect directlory & sub driectories

ls-a - shows hidden files

------------------------- CAT --------------------------------
cat command:

create file :
cat (enter)
> fileName1
> file content

combining file:
cat fileName1 fileName2 > newFileName

to view file content:
cat newFileName
------------------------ delete ---------------------------------
delete file
rm newFileName
------------------------- move --------------------------------
move a file ( file to a new directory )
mv fileName1 /home/dir1/dir2  --- permission denied

we need super user credentials for this
sudo mv fileName1 /home/dir1/dir2 

---------------------- rename -----------------------------------

rename file name
mv fileName newFileName

--------------------- mkdir ------------------------------------
create directory:
mkdir songs

create sub directories:
mkdir temp/songs

multiple directories:
mkdir  dir1 dir2 dir3

--------------------- rmdir ------------------------------------

deletes directory with contents init
rmdir dir1
---------------------------------------------------------
Help - Man

man ls
help information
---------------------------------------------------------
history
>history
---------------------------------------------------------
clear command
> clear