ypchsh
: To switch your shell globally. Default is tcsh
.
chmod
: To change the attribute of a file or a directory.
Usage: chmod [ugoa][+-][rwx] file
For instance if you don't want others to read your file,
chmod o-r your_fileThat is, ``change the mode of
your_file
so that others
can't (-
) read it''.
u
is the user, that's you.
a
is all and
g
is group.
+
adds the attributes, -
subtracts them,
w
is write privilege, x
is execute privilege.
df
du
.tcshrc
file in your home dir. For
instance, add
set path = (. $path)if you want to put the current directory before the default path or
set path = ($path .)to put it after the default path.
convert picture.eps picture.jpgThis converts
picture.eps
to picture.jpg
.
The known formats are
.ps, .eps, .pdf, .png, .pnm, .gif, .jpg, .tiff
, etc.
If convert
is not installed on your machine, do
which pngtopnm
pngtopnm
is in. Go there and ls
.
You should see 200+ converters for almost all combinations.
ps2epsi picture.ps
picture.epsi
.
ps2ascii paper.ps output.txt
paper.ps
.
display picture.jpg
display
is not installed, then use xv
.
nice
: To be nice to other people using the same machine
nice prog_name
>
and <
: Redirect.
If a program takes standard input (STDIN)
from the keyboard, you can create a file
with all the data and do
prog < input_dat
and the program will take the lines in input_dat
as if it is given
at the command prompt followed by return
.
If the program
prints out to the standard output (STDOUT)
or on your screen, you can redirect it to
a file using > output_data
. Namely
prog < input_data > output_dataNote that redirect destroys
output_data
. If you want to append to
the file use >> output_data
.
|
: Pipe is used when you want to string programs that
take a file as an input but writes on to STDOUT.
Take a look at this example. Suppose you have a jpeg file you want
to convert to a png file. And suppose your convert
does not function
somehow. Now there is this command
jpegtopnm picture.jpgwhich writes out a pnm file to STDOUT, or on your screen. Don't try this. It'll mess up your screen. You can always redirect it
jpegtopnm picture.jpg > picture.pnmthen use
pnmtopng picture.pnm > picture.pngagain redirecting it to a file. This process, however, can be short-circuited using pipe:
jpegtopnm picture.jpg | pnmtopng > picture.pngThis is also very useful when a program produces a massive amount of output that just flies by. In that case try
prog_name | lessYou can then treat the output of this program as if it is a file and use
less
to navigate around.
grep
: To globally search regular expression and print the
line.
Or in English, grabs line that contains a word or phrase from a file
or files and writes to STDOUT.
grep word file.txt or grep "A word with you, sir." file*.txt