Thursday, August 28, 2008

Unix commands

cd matlab change to the subdirectory named matlab
cd change to the home directory
cp file1 file2 make a copy of file1 called file2
cp dir2/file1 . copy file1 from directory dir2 into current directory
echo $param show idefinition of param
env show values of environment variables
history show previous commands by number
lpr -Pworkman54 f1 print f1 (notice capital P)
lpq -Pworkman54 look at printer queue for sage
ls *dwg list names of all files ending in the letters dwg
man cp learn more about cp command (manual)
mkdir ansys make a new directory called ansys (change to root
first with cd command)
more file1 look at file1 page by page (usually aliased to just m)
mv file1 file2 move or rename file1 to file2
pwd show current directory name
rm *bak remove all files ending in the letters bak
abbr=orig define abbreviation (usually shorter)
tail -15 file1 look at last 15 lines of file1

You can rerun previous commands and make changes with emacs commands:
^P redisplay previous command (then use commands to change it)
^Rls repeat most recent command that begins with ls
!5 repeat command 5 (use history or h to find the command number)
!^ first option of previous command
!$ last option of previous command
!* all options of previous command
!:2 second option of previous command

Before erasing files, check that the parameters are correct. For example, first give:
ls fname* # list corresponding files
rm !$ # erase those files

To copy files from my class directory, define a short symbol a, then check th












rm': Remove files or directories
=================================

`rm' removes each given FILE. By default, it does not remove
directories. Synopsis:

rm [OPTION]... [FILE]...

If a file is unwritable, standard input is a terminal, and the `-f'
or `--force' option is not given, or the `-i' or `--interactive' option
_is_ given, `rm' prompts the user for whether to remove the file. If
the response does not begin with `y' or `Y', the file is skipped.

The program accepts the following options. Also see XRef Common
options.

`-d'
`--directory'
Remove directories with `unlink' instead of `rmdir', and don't
require a directory to be empty before trying to unlink it. Only
works if you have appropriate privileges. Because unlinking a
directory causes any files in the deleted directory to become
unreferenced, it is wise to `fsck' the filesystem after doing this.

`-f'
`--force'
Ignore nonexistent files and never prompt the user. Ignore any
previous `--interactive' (`-i') option.

`-i'
`--interactive'
Prompt whether to remove each file. If the response does not begin
with `y' or `Y', the file is skipped. Ignore any previous
`--force' (`-f') option.

`-r'
`-R'
`--recursive'
Remove the contents of directories recursively.

`-v'
`--verbose'
Print the name of each file before removing it.

One common question is how to remove files whose names begin with a
`-'. GNU `rm', like every program that uses the `getopt' function to
parse its arguments, lets you use the `--' option to indicate that all
following arguments are non-options. To remove a file called `-f' in
the current directory, you could type either:

rm -- -f

or:

rm ./-f

The Unix `rm' program's use of a single `-' for this purpose
predates the development of the getopt standard syntax.


Prev (fileutils) mv invocation Up (fileutils) Basic operations
--------------------------------------------------------------------------------
automatically generated by info2html


















FTP Options
===========

`--retr-symlinks'
Retrieve symbolic links on FTP sites as if they were plain files,
i.e. don't just create links locally.

`-g on/off'
`--glob=on/off'
Turn FTP globbing on or off. Globbing means you may use the
shell-like special characters ("wildcards"), like `*', `?', `['
and `]' to retrieve more than one file from the same directory at
once, like:

wget ftp://gnjilux.cc.fer.hr/*.msg

By default, globbing will be turned on if the URL contains a
globbing character. This option may be used to turn globbing on
or off permanently.

You may have to quote the URL to protect it from being expanded by
your shell. Globbing makes Wget look for a directory listing,
which is system-specific. This is why it currently works only
with Unix FTP servers (and the ones emulating Unix `ls' output).

`--passive-ftp'
Use the "passive" FTP retrieval scheme, in which the client
initiates the data connection. This is sometimes required for FTP
to work behind firewalls.

No comments:

Search

My Blog List