USEFUL CSHELL SYMBOLS


|                                   Pipe the output of a command to be processed by another command.
Usage: command1 |command2
Eg: ls -l | more
more file-name | grep pattern
more filename | wc
>                                 Redirect output........ to file (overwrite ).
Usage: command > filename
Eg: wc filename > new-file
>>                               Append (the result of the command) to the end of the file.
Usage: command >> file-name
Eg: pwd >> existing-file
<                                 Take the input for the command from a file.
Usage: command1 < filename.
&                                 Run process in the backgound so that the shell remains active.
Usage: program-name &
program-name filename &
;                                   Separate commands on the same line.
Usage: command1 ; command2
Eg: pwd ; ls
*                                  Match a string of zero or more characters.
Eg: cp * copy all files
cd publ* go to any directory that begins with publ
cd *tory go to any directory which ends with tory
cp *.* copy all files that contain a dot
?                                  Match a single character.
Eg: grep d?n filename display all lines that contain
dan, don, din, dgn, ect.
 [ ]                               Match any of the enclosed characters.
Eg: grep [abc] filename
grep [a-z] filemane Hyphen is used to specify a range.
$var                           Anything thats starts with a $ is a variable.
#                                 Begin comments (used in the Cshell script files).
~                                 Home directory symbol.
Eg: cd ~ go to home directory of the current user.
cd ~rob go tot home directory of user rob.
$home                      Home directory .
!           The history commands.
!!         Redo last command.
!str     Redo the last command that starts with str.
!23      Redo the 23rd command.
!-2       Redo the (last command -2)
^                                 Quick modifier for the last command.
Usage: ^mistake^correction.
&&                              The logical and symbol : execute first command then if successful, the second command.
Usage: <command1> && <command2>
||                                 The OR symbol : executes the first command or, if it fails, the second command.
Usage: <command1> || <command2>
./                                 Runs a compiled program.
Usage: ./ program-name


Previous                                                                                                      Next

No comments:

Post a Comment

Copyright © EduRAR @ www.edurar.blogspot.in