Sunteți pe pagina 1din 3

open pdf file:- evince mohit.pdf replace,undo,redo,su,chmod, ./, >,sed replace cammand::13,37s/moh/mohit/g :1,$s/moh/mohit/g he file.

undo:- u redo:- ctrl+r su(switch user): su cammand use for switch the user (eg:- su mohit, after this s ystem ask the password, after entering the password user will change)

:-to replace the moh to mohit from line 73 to line 37. :-to rplace the moh to mohit from line 1 to last line of t

chmod(change mode):- use for changing the mode of file or directory eg:chmod 764 filename here sets read, write and execution access for the owner and read and write and no execution for group, and read, no write, no execute for others To view the current file mode:$ ls -l ''file'' To view the all file mode:$ ls -ltr r w x # 4 2 1 0 read read a file or list a directory's contents write write to a file or directory execute execute a file or recurse a directory tree Permission read only write only execute only none

7(1+2+4) full 6(4+2) read and write 5(4+1) read and execute 4 read only 3(2+1) write and execute 2 write only 1 execute only 0 none Operator + = ed classes Description adds the specified modes to the specified classes removes the specified modes from the specified classes the modes specified are to be made the exact modes for the specifi

Command line examples: command explanation chmod a+r file read is added for all chmod a-x file execute permission is removed for all

chmod a+rw file for all. chmod +rwx file permission chmod u=rw,go= file cleared for

change the permissions of the file file to read and write On some UNIX platforms such as BSD, this will restore the of the file file to default: -rwxr-xr-x. read and write is set for the owner, all permissions are

the group and others chmod -R u+w,go-w docs change the permissions of the directory docs and all its contents to add write access for the user, and deny write access for everybody else. chmod file removes all privileges for all chmod 777 file change the permissions of the file file to read, write, an d execute for all. chmod 4755 file the 4 specifies set user ID and the rest is equivalent to u=rwx (4+2+1), go=rx (4+1 & 4+1). chmod -R u+rwX,g-rwx,o-rwx directory set a directory tree to rwx for owner di rectories, rw for owner files, --- for group and others. chmod -R a-x+X directory remove the execute permission on all files in a directory tree, while allowing for dir ectory browsing. ./ means- if a path is /home/mohit/test1/test2/ and we are in mohit dicrectory t han no need write whole path just ./test1/test so ./ is consider as /home/mohit > file_name:- standard output text,write into the file_name. ls > mohit.txt in this except the standard out it write the all f older or file into mohit.txt file sed :-(stream editor) You can use the sed command to change all occurrences of o ne string to another within a file, just like the search-and-replace feature of your word proce ssor. The sed command can also delete a range of lines from a file eg:- 1 replace-> sed 's/oldstring/newstring/g' <file_name> i.e. sed 's/lamb$/ham/g' mohit.txt 2 Deletion-> sed '<start>,<end>d' <file_name> i.e. sed '2,3d' mohit.txt note:- Since sed is a stream editor, it takes the file given as input, and sends the output to the screen, unless you redirect output to a file. In other words, s ed does not change the input file. To change and save the results in a new file, enter this: sed 'oldstring/newstring/g' mohit.txt > new.file

Extract tr.gz. file :To extract one or more members from an archive, enter:

tar -zxvf {file.tar.gz} grep with line number:- grep -n "mohit" tmp.txt

S-ar putea să vă placă și