Linux-commands-May24-1
Linux-commands-May24-1
-----------------------------------------------------------------------------------
----
cd dir/dir2/
cd ../../.. --->
vi filename
esc --> :wq! ---> save content of a file (write and quit )
esc :%s/current-string/new-string/g
esc :%s/linux/windows/g
-------------------------------------------------------
esc:4s/linux/windows/g
---------------------------------------------------------
need to replace from 2nd to 4th line
esc:2,4s/linux/windows/g
-----------------------------------------------------------------
esc:2,$s/linux/windows/g
----------------------------------------------------------------
how do set line numbers
--------------------------------------------------
need to move cursor to particular line
esc :line_number
esc : 4 ---> cursor will move to 4th line
-----------------------------------------------------------------------------
esc press dd
---------------------------------------------------------------------
===================================================================================
=======
cp is used to copy file
cp test1 temp1/temp2/temp3/
----------------------------------------------------------------------
copy dir to another dir
cp -r dir1 dir2
----------------------------------------------------------------------
cp test1 file1 test3 temp ---> copy multiple files or dirs to another dir
---------------------------------------------------------------------------------
mv file1 file2
--------------------------------------------------------
mv file1 dir2
-------------------------------------------------------
mv file1 file2 file3 dir1 ---> move multiple files to directory
---------------------------------------------------------
u--> user, g--> group and o--> others
-----------------------------------------------------------------------------------
----
-----------------------------------------------------------------------------------
-
df -h . ----> used to check disk size
-------------------------------------------------------------------
echo "hi how r u" is used to print