Command-line Work on Linux Server
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:
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.
- Click on the white window icon, or use your computer menu of programs to select the Secure Shell Client.
- 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.
- Enter your password, and click "ok".
- 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.
- You can resize the windows by dragging their corners, and you can relocate the windows by clicking/dragging the top bar.
- 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.
- 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.
- 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.
- 'ls' means "list." This is the command you type in to list the contents of the current directory.
- '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.
- To also see system hidden files, use 'ls -la' (a is for 'all').
- 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.
- 'cd' means "change directory." This is the command you type in to change directories on the server.
- if you type in 'cd' with no parameters (nothing following the command)