linux command part-2

 Linux Session 2

=================


1. touch command


is to create an empty file.


touch file1


you can change the timestamp of an existing file.


touch file1




2. mkdir command


this command is used to create a new directory.


mkdir dir1


mkdir dir2 dir3 dir4






3. rmdir command


this command is used to delete or remove a directory.


the below command will only work if dir1 is empty.
rmdir dir1




4. change directory using cd


cd dir2


create files inside dir2 using touch command


touch file1 file2 file3


cd ..


rmdir dir2 (this will give error saying directory not empty)






5. rm command 


this command is used to delete files or even directories.


rm file1 (to remove a file)


rm -R dir2 (to remove a directory recursively)






6. cp command


used to copy the files or directories


cp file1 file2 (will create a copy of an existing file named file1 with the name file2)


cp file1 dir3 (will copy the file1 into directory3)


cp -R dir5 dir6 (will copy the entire dir5 inside directory6 recursively)






7. mv command


to move a file from one folder to another.


to rename a file


cd ../..


mv file1 file8 (will rename file1 to file8)


mv file8 dir4 (will move the file8 to dir4, its like a cut and paste)

Comments

Popular posts from this blog

scala-4