Make Files

Create a log file using cat command :


cat > /filepath/fileName.ext [ENTER]

testText1

testText2

---

Enter CTRL+C to exit from cat.

Make directories

Create a directory :

mkdir dirname

Create multiple directories

mkdir dirname1 dirname2 dirname3

Create directory with Parents

mkdir -p dir1/dir2/dir3

Create directory with a Message

mkdir -v dirname1 dirname2 dirname3

Delete Directories

Delete an empty directory :

rmdir dirName

Delete an empty directory :

rmdir dirName

Delete empty directories :

rmdir dirName1 dirName2

Delete a non-empty directory with sub-folders and contents (recursive removal) :

rm -rf /path/to/directoryOrFile

Delete all components in the directory path name (if they are empty – starting from last most component) :

rmdir -p /tmp/x/y/z

If you encounter an issue with deleting the directory / file, check the permission of the parent directory. I got some files saying “Permission cannot be determined” notification. But it disappeared when I gave chmod 777 to parent directory.

Copy / Cut – Paste

Copy and Paste – Asking you if you want to replace the file – interactive

rmdir -p /tmp/x/y/z

Copy and Paste – Creating a backup of your file

cp -b /home/levan/kdenlive/untitelds.mpg /media/sda3/SkyDrive

Copy and Paste – a directory with it’s content

cp -Ri ~/MyFolder /sda3/

Cut and Paste a file

mv -i ~/MyFile ~/OtherFolder/MyFile

Cut and Paste – a directory with it’s content

mv -Ri ~/MyDirectory ~/OtherDirectory/

 

 

Reference :

Advertisements