Useful UNIX commands

Basic File Management

Once you've connected, you can use these commands to use the Ulyssis shell.

First of all, whenever you need to type a longer command or filename, try the TAB key as it will try to complete the name of the command or file you are typing. Pressing TAB twice will show a list of possible completions.

  • cd directoryname

    Change directory. Works the same as under MS-DOS. cd without argument changes to your home directory (like My Documents in windows). Go to the parent dir with cd .., not with cd..

  • ls

    List the contents of the current directory. Many different formats are available, a common one is ls -al. To accomodate MS-DOS/Windows users, dir is an alias (synonym) for ls -alF, which gives output similar to the dir command in MS-DOS/Windows.

  • cp inputfile targetfile

    Copy inputfile to targetfile. Additional arguments (e.g. -r or -v are explained in the man-page.)

  • mv inputfile targetfile

    Move inputfile to targetfile. Additional arguments (e.g. -i or -v are explained in the man-page.) This is the way to rename a file. Note that you cannot use a construction like mv *.htm *.html to add an ``l'' to a bunch of files. A small shell script can provide a way to do this: for i in *.htm; do mv i; done.

  • rm filename

    Remove filename. Additional arguments (e.g. -r or -v are explained in the man-page.) Note: there is NO undelete-alike function in most unices.

  • mkdir dirname

    Creates a directory.

  • rmdir dirname

    Removes an empty directory.

Getting Help

  • man command-name

    Displays manual pages, if available. E.g. man man. Relatives : apropos, help

  • apropos word

    Searches through headers of all man pages.

  • help command-name

    Displays help about command-name. Only for internal bash-functions.

  • bash

    The Bourne Again SHell. Widely used successor of sh, the Bourne shell. This is the program you're working under after you open a ssh-session (you don't have to start it to use it). Bash interprets your commands, and executes them. Tab-completion, * and ? expansions, ...are all bash functions. man bash will give you tons of info about it. Alternatives : tcsh, zsh, rc

Text Editors

It's easier to use a text editor on a server, than editing your file locally and uploading that file.

  • pico

    Probably the easiest text editor. Should be self-explanatory.

  • joe

    Another easy text editor. Press control+C to quit.

  • vim

    Probably the best text editor. Start editing by pressing i. Stop editing by pressing the escape key. Save and quit with :wq. Quit without saving with :q!.

Utilities

  • df

    Displays info about the free diskspace on the system. df . will give info about the filesystem where the current directory resides. The output becomes a bit more readable with the -h switch.

  • du

    Displays info about the diskusage in the current directory (and its subdirectories. A common parameter is -s , equivalent to -summarize , to summarize the disk-usage (without the per-subdir totals).

  • quota

    Displays info about your diskusage, and your disk quota. Quota are limits on diskusage, imposed by the system administrator. The system will warn you if you exceed these limits.

  • ps

    Displays info about processes. Various options, e.g. ps auxf gives info on all processes, including process owner, memory usage, and parent-child indication.

  • top

    Displays top CPU processes. Use it to see what gets most cpu power at the moment. Don't leave top open for a long time, since it eats cpu time itself. (quit with q).