Archive for August 17th, 2007

working with file

1. create a file
taufanlubis@zyrex:~$ cat > testing
This is a testing file.
This is a testing file.

taufanlubis@zyrex:~$ ls testing


2. rename a file

taufanlubis@zyrex:~$ mv testing testing_new
taufanlubis@zyrex:~$ ls testing_new



3. delete a file
taufanlubis@zyrex:~$ rm testing_new
taufanlubis@zyrex:~$ ls testing_new

ls: testing_new: No such file or directory


working with directory

1. create a directory
taufanlubis@zyrex:~$ mkdir test
taufanlubis@zyrex:~$ ls -l
total 408
drwxr-xr-x 2 taufanlubis taufanlubis 4096 2007-08-16 19:01 test


2. rename a directory
taufanlubis@zyrex:~$ mv test test_dir
taufanlubis@zyrex:~$ ls -l
total 408
drwxr-xr-x 2 taufanlubis taufanlubis 4096 2007-08-16 19:01 test_dir


3. delete a directory (if the directory is empty)
taufanlubis@zyrex:~$ rmdir test_dir/
taufanlubis@zyrex:~$ ls test_dir
ls: test_dir: No such file or directory


4. delete a directory (if not empty)
You can not use ‘rmdir’ to a not-empty directory. Let’s us make a try.

taufanlubis@zyrex:~$ mkdir test (create a directory)
taufanlubis@zyrex:~$ cd test (go to the directory)
taufanlubis@zyrex:~/test$ cat > file1 (create a file)
this is file1


taufanlubis@zyrex:~/test$ ls (check the existing file)

taufanlubis@zyrex:~/test$ cd .. (go outside the directory)
taufanlubis@zyrex:~$ rmdir test (try to delete it using ‘rmdir’)
rmdir: test: Directory not empty (you will see a warning message)



How to delete a not-empty directory?
You have to use ‘rm -rf’ command.
taufanlubis@zyrex:~$ rm -rf test/
taufanlubis@zyrex:~$ ls test

ls: test: No such file or directory


What is ‘rm -rf’?

‘rm’ is the same command when you use to delete a file or files. But, with an option ‘rf’, you can use it to delete a directory, even when it’s not empty.

-r, -R,
–recursive remove directories and their contents recursively

–force ignore nonexistent files, never prompt

Read Full Post »

There 5 methods in using ‘cd’:

  1. cd /path/directory move to a ‘/path/directory’

  2. cd directory move to a ‘/directory’

  3. cd – go back

  4. cd .. go up 1 level

  5. cd back to /home directory


Now, let’s practice.
I’ll show you some examples. My position is at /home/taufanlubis.

method # 1
taufanlubis@zyrex:~$ cd /usr
taufanlubis@zyrex:/usr$ ls -l
total 180
drwxr-xr-x 2 root root 53248 2007-08-12 12:45 bin
drwxr-xr-x 3 root root 4096 2007-08-11 07:32 etc
drwxr-xr-x 2 root root 4096 2007-04-15 18:52 games
drwxr-xr-x 35 root root 4096 2007-08-05 05:29 include
drwxr-xr-x 175 root root 69632 2007-08-12 11:04 lib
drwxr-xr-x 3 root root 4096 2007-08-01 06:58 lib64
drwxr-xr-x 10 root root 4096 2007-04-15 18:48 local
drwxr-xr-x 2 root root 12288 2007-08-13 13:57 sbin
drwxr-xr-x 323 root root 12288 2007-08-12 12:45 share
drwxrwsr-x 11 root src 4096 2007-08-16 07:26 src
drwxr-xr-x 3 root root 4096 2007-04-15 18:50 X11R6


method # 2
(go to directory inside /usr, you don’t have to use /games)
taufanlubis@zyrex:/usr$ cd games

method # 5
(go to home directory)
taufanlubis@zyrex:/usr/games$ cd

method # 3
(go to the previous directory)
taufanlubis@zyrex:~$ cd –


method # 4
(go up 1 level)
taufanlubis@zyrex:/usr/games$ cd ..



Read Full Post »


Get every new post delivered to your Inbox.

Join 81 other followers