Basic LINUX - 5

on 8:54 AM

To copy files

[root@database ~]# cp anaconda-ks.cfg file1

To copy folders

[root@database ~]# cp -r dir2 Desktop

To rename  directories and files

[root@database ~]# mv dir3 d4

To move directories and files 


[root@database ~]# mv dir2 /opt

To move directories and files 

[root@database ~]# mv dir2 /opt

To see the type of file

[root@database ~]# file *

Basic LINUX - 4

on 8:47 AM

11. To create nested directories

[root@database ~]# mkdir -p d1/d2/d3/d4

To see the tree structure

[root@database ~]# ls -R d1
d1:
d2

d1/d2:
d3

d1/d2/d3:
d4

d1/d2/d3/d4:


12. To change a directory

[root@database ~]# cd dir1

[root@database ~]# cd ..

[root@database ~]# cd ../..

[root@database ~]# cd -
/root

[root@database ~]# pwd
/root

[root@database ~]# cd

[root@database ~]# pwd
/root

[root@database ~]#

13. To remove files

[root@database ~]# rm file1

rm: remove regular file `file1'? y

14. To remove an empty directory

[root@database ~]# rmdir dir1

[root@database ~]# ls

anaconda-ks.cfg  Desktop  dir2  dir4  f2  f4     file3        install.log.syslog
d1               dir      dir3  f1    f3  file2  install.log  labmanual

15. To remove a directory

[root@database ~]# rm -rf dir

[root@database ~]# ls
anaconda-ks.cfg  Desktop  dir3  f1  f3  file2  install.log         labmanual
d1               dir2     dir4  f2  f4  file3  install.log.syslog

Basic LINUX - 3

on 8:37 AM

5. To create a file

[root@database ~]# cat > file1
hi how are you

6. To see file content

[root@database ~]# cat file1
hi how are you


7. To append a file

[root@database ~]  cat >> file1
iam fine, it is very nice

[root@database ~] cat file1 file2 >> file3 #redirecting output to file3

[root@database ~] cat file3

8. To create a file using touch command

@ Touch - The touch command is the easiest way to create new, empty files.

[root@database ~]# touch f1 f2 f3 f4

[root@database ~]# ls

9. Creating a single directory

[root@database ~]# mkdir dir

10. Creating multiple directories

[root@database ~]# mkdir dir1 dir2 dir3 dir4

[root@database ~]# ls

anaconda-ks.cfg  dir   dir2  dir4  f2  f4     file2  install.log       
labmanual

Basic LINUX - 2

on 8:20 AM

To see a file starting from f

[root@database ~]# ls f*

To see a file have a middle string as disk

[root@database ~]# ls /bin/*disk*

To see a file whose length is 3 characters

[root@database ~]# ls ???

To see a file which starts with single char & ends up with any number of character

[root@database ~]# ls ?edh*

Basic LINUX

on 8:16 AM

Basic Linux Command

1. To check the present working directory


 [root@database ~]# pwd

/root

2. To show the contents of a directory (folder)


[root@database ~]# ls


3145.zip  args1    database_notes  Documents   ifcfg-eth1_March25  linux_image.iso  names         phonenubers  uln_migrate             uln_register.tar
args      BegPerl  Desktop         hello2.plx  index.html.1        mbox             oradiag_root  scripts     

3. To see more details including the permission regarding the contents of a
directory (folder)

[[root@database ~]# ls -l
total 3511620
-rw-r--r--  1 root   root       422670 Dec 30 10:29 3145.zip
-rwxr--r--  1 root   root          105 Apr  8 21:45 args
-rwxr--r--  1 root   root           32 Apr  8 21:51 args1
drwxr-xr-x 17 root   root         4096 Dec 30 10:31 BegPerl
-rw-r--r--  1 root   root         5022 Jan  5 09:55 database_notes
drwxr-xr-x  3 root   root         4096 Mar 25 04:45 Desktop
drwx------  3 root   root         4096 Mar 30 21:33 Documents

4. To see all contents including hidden files of a directory (folder)

[root@database ~]# ls -a             
 .bashrc         .eggcups         .gstreamer-0.10     mbox                 scripts                 uln_register.tar             .xauthgXJKsS - 

5 . To see tree structure of nested directories

[root@database ~]# ls -R /opt
/opt:
ORCLfmap
sqldeveloper
sun
VBoxGuestAdditions-4.2.6

/opt/ORCLfmap:
prot1_32