Vous êtes sur la page 1sur 4

Chapter 4 : Browsing The File System After this chapter you are able to: create and view

file. copy,move,delete file. modify file content. Directory create work with Directory.

1) CREATE AND VIEW FILE. - foure way to create file. vim command touch command cat command nano command

- vim command: vim command is use to create file.it also use to open and modify the file. ex:- vim /tmp/samplevim.txt

- touch command: touch this command is also use to create the file. but you can't open the file using touch.you must open the file using nano and vim command. ex:- touch /tmp/sampletouch.txt - cat command : this comman is use for file creation. to modify it you need to open this file using vim command. you can see the contant of thid file using cat command. Ctrl + d command to save the content. ex:- cat > /tmp/samplecat.txt cat /tmp/samplecat.txt

- nano command: this command is use to create file with menu option. ex:- nano /tmp/samplenano.txt

2) COPY MOVE AND DELETE FILE.

- To Copy the file from one location to other, the below command is use. - cp -rfv /tmp/samplevim.txt /etc/ where -rfv = recorsive mode with verbose and forcefully. /tmp/samplevim.txt = is source path /etc/= is Destination path

- To Move the file from one location to other, the below command is use. - mv -rvf /tmp/saplecat.txt /etc/ Where -rfv = recorsive mode with verbose and forcefully. /tmp/samplevim.txt = is source path /etc/= is Destination path

- To Delete the file,the below command is use. - rm -rf /tmp/sapletouch.txt where -rf = recorsive mode with forcefully. /tmp/samplevim.txt = is source path

- Rename the file.... mv -rf /tmp/samplevim.txt /tmp/vim.txt to rename the file you must move the file in same directory with different name...

3) Modify File Containt. - open the file : vim and nano command is use to open the file - vim /tmp/samplevim.txt - i key : this key is used for enabling the insert mode,that you able to insert the text in file. - ESC key: this key is use to come out from insert mode.

- :wq : this command is use for SAVE AND QUIT from file. to use this command, you must come out from insert mode (press E SC key). - :q! : this command is use for QUIT from file without SAVE the file con taint.to use this command, you must come out from insert mode (press ESC key). - Shift + zz : this command is use for SAVE AND QUIT from file. to use this command, you must come out from insert mode(press ES C key). - y : this command is use for copy the line. to use this command, you must come out from insert mode (press ES C key). ex:- if you use y command with digit it copy the number of line . y5 - copy the five line from current position. yy - copy the current line. - p : this command is use to paste the copied line. to use this command, you must come out from insert mo de (press ESC key). - dd : this command is use to delete the current line. to delete the cur rent line you must come out from insert mode (press ESC key). - u : undo only the last edit.to use this command, you must come out from insert mode (press ESC key). - Shift + u : undo all change in current line.to use this command, you must come out from insert mode (press ESC key). - x : delete the current character.to use this command, you must come out from insert mode (press ESC key).

4) CREATE DIRECTORY : - use below command to create the directory in linux. - mkdir /tmp/testdirectory

5) WORK WITH DIRECTORY. - pwd : present working directory. show the path of directory in which you currently present.

- ls : long listing. long lising of directory. - ls -l : long listing of directory and file with many imformation. - ls -la : long listing of Directory with hidden file. - ls -ld : long listing of directory. only list of directory not file. - cd : change the directory. ex: cd /etc/sysconfig/ - cd .. : come out one step behind from directory. that's it now you r able to hendle the file, crate delete and remove the file. enjoy................

Vous aimerez peut-être aussi