Tuesday, July 19, 2011
9:10 PM

GNU/Linux Most Wanted Command

Wow, judul postingannya keren betul. GNU/Linux Most Wanted Command. Basa Inggris dikit ah ;) Maklum lagi inget ama Mr Tono, My English teacher at Senior High School. Hello Mr Tono.. How are you?

1. Handling Directory

Create a directory :

mkdir name-of-the-directory [ mkdir test ]

Create nested directory ( directory with sub directory ) :

mkdir -p directory1/directory2

Enter to directories :

cd name-of-the-directory [ cd directory1 ]

cd .. [ go to the parent directory ]
cd - [ go to previous directory ]
cd [ go to /home/*active-user directory ]
cd /home [ goto /home directory ]
cd / [ go to "/" or root ]
cd ~joherujo [ goto home directory of joherujo ups.. my home directory ]
cd /joherujo [ goto /home/joherujo ]
pwd [ Print the current working directory ]

2. About copy file / directory

Copy file to another directory

cp source-file destination (file or directory)

i.e :

cp test.txt Documents/text [ copying test.txt to the Documents/text directory ]
cp test.txt test-copy.txt [ copying test.txt to the new file test-copy.txt ]

Copy file(s) to another directory

cp source-file destination-directory

i.e :

cp test.txt /home/joherujo/data/text/ [ copying test.txt to /home/joherujo/data/text/ ]

Copy directory recursively ( directory with sub-directory or file(s) )

cp -r source-directory destination-directory

or

rsync -a source-directory destination-directory

i.e


cp -r test test-copy
rsync -a test test-copy

3. Rename / Remove File(s) / Directory

rm file1
rm file2
rm file3
rm file1 file2 file3

Remove an empty directory

rm name-of-directory

i.e

rm dir1

Remove non emty directory

rm -rf directory
rm -R directory

Rename file / directory

Rename directory

mv old-directory new-directory

i.e :


mv old new

Rename file

mv old-file new-file

i.e :

mv old.txt new.txt

Segitu dulu jo.. next time di lanjut.. I'm sleepy

0 comments:

Post a Comment