Command-line Work on Linux Server

From UA Libraries Digital Services Planning and Documentation
Revision as of 08:45, 20 May 2010 by Jlderidder (Talk | contribs)

Jump to: navigation, search

The storage/delivery server operating system is SUSE Linux, and the default shell (command line interpreter) via ssh (Secure Shell access) is BASH.

The following are a few commands to help the beginner locate files and open, view, and close them on the server, as well as to run command-line scripts. More information is available at the links provided:

  1. BASH Reference Manual
  2. VI Editor commands
  3. SSH User Manual


SSH: to get to the server

SSH offers 2 interfaces: a command-line interface (the white window icon) and a graphical user interface (GUI: the yellow folder icon). While you may use the GUI for browsing to locate content, you will need the command-line interface for running scripts. So the following instructions are for this latter interface.

  1. Click on the white window icon, or use your computer menu of programs to select the Secure Shell Client.
  2. You may either select the libcontent1 profile, if already programmed in, or click "Quick Connect" and enter in "libcontent1.lib.ua.edu" and the user name.
  3. Enter your password, and click "ok".
  4. You are now at the command line on the server, and within the BASH shell. If at this point, you click on the yellow folder icon at the top, it will open up the graphical user view of your home directory, which may help. Also, clicking on the white window icon at the top will open another command-line interface of your home directory. You may open as many of these as is helpful, so as to work in multiple directories at the same time. This can be useful if you want to run scripts from one directory, view the output in a second directory, and examine the files to be processed in a third directory.
  5. You can resize the windows by dragging their corners, and you can relocate the windows by clicking/dragging the top bar.
  6. to change settings, such as font size, color, type, and background colors, click "edit", click "settings", and select Global Settings/Appearance/Font or Colors. Make your selections and click "OK". It helps if you select text colors and cursor color that will stand out against the background selected.
  7. To exit the server, type "exit" on command line of each window open, or simply close all SSH windows. Before you exit, be sure to close any files you have opened, or the server will retain the "opened" file for recovery until you return.
  8. Never leave your desktop unattended while you have an SSH window open on the server; this is a serious security risk. If you must leave your desktop while SSH is open, lock the access to your desktop first.

For further information: SSH User Manual



BASH: to get around on the server, and run scripts

To find out more about any of these commands, go to Google and type in "manpage" and then the command. Or, on the commandline, type in "man", space, and the basic command without the parameters which follow it. This will open the text version of the manpage stored on the server, and it will open it in VI (next section discussed). For example, "man ls" will give you an option of two versions of the 'ls' command. Enter "1" and a text file will open in the window. Use "control-F" to move forward in the file and "control-B" to move backwards in the file. Alternatively, you can use the arrow keys to scroll up and down. To close the file, type colon q (':q').

All commands should be followed by hitting the "enter" key.

  1. 'ls' means "list." This is the command you type in to list the contents of the current directory.
    1. 'ls -l' (that is el ess space hyphen el) will provide a complete (el is for 'long') listing of all non-system files in a long format, so you can see who the files and directories belong to, permissions issues, size of files, and date created.
    2. To also see system hidden files, use 'ls -la' (a is for 'all').
    3. To list the contents of a directory, add the name of the subdirectory: 'ls UploadArea' will list the contents of the UploadArea subdirectory. 'ls UploadArea/MODS" will list the contents of the MODS directory within the UploadArea directory.
  2. 'cd' means "change directory." This is the command you type in to change directories on the server.
    1. if you type in 'cd' with no parameters (nothing following the command)
Personal tools