Difference between revisions of "Terminal Guide"

From GroovixWiki
Jump to: navigation, search
Line 32: Line 32:
 
ping&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pings a system ''Note: filtered webs will not respond'' <br />
 
ping&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pings a system ''Note: filtered webs will not respond'' <br />
 
rm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete a file<br />
 
rm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete a file<br />
shutdown&nbsp;&nbsp;&nbsp;&nbsp;shuts down the computer (requires a time) (-r option will reboot)<br />
+
shutdown&nbsp;&nbsp;&nbsp;&nbsp;shuts down the computer (requires a time) (-r option to reboot, -h option to halt)<br />
 
su&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch user<br />
 
su&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch user<br />
 
xkill&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changes the mouse cursor to an x, click on a window to close that window/program<br />
 
xkill&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changes the mouse cursor to an x, click on a window to close that window/program<br />

Revision as of 23:56, 28 September 2010

Note: The terminal interface can be a very powerful tool, it is recommended for advanced technicians that are comfortable working with a 'Command Line Interface'.


The terminal command line interface (or terminal) is non-graphical and used by typing individual commands for each task. Tasks such as navigating directories or folders, editing text files, moving/copying files are all done with typed commands. This might seem slow or obsolete compared to a modern graphical interface, but the terminal interface is capable of incredibly complex commands that can automate many tasks with one line of commands. The terminal interface used in Groovix is known as xterm, both terminal and xterm can be used interchangeably. From now on, this wiki will only be using xterm when referencing the terminal interface.

When working with xterm, pay attention to the user; different user accounts have different privileges which can give unexpected results or deny commands. To identify which user is logged in, find the current line in the xterm window; it will be displayed as user name @ workstation name (ex. gvuser@inet-7). To change which user is logged in, type su [username] where [username] is the user you want to log in as and press [ENTER]; log-in will be successful once the password for that user is entered.

Using Commands

Commands follow a simple structure that must be followed to execute the command properly, [command] [option(s)] [*]. All commands are followed by a space if an option is used. Multiple commands can be typed on one line but must be separated by a semicolon.

Note: adding ‘--help’ after a command will display the command description and options available for that command.

Some commands require extra information such as a time or path, these come after any options. For example, the shutdown command requires a time indicated for when the shutdown should occur (ex. shutdown -r now).

Using Options

Options are used to customize or specify how a command should execute. Options are always typed with a hyphen followed by a single letter with no space (ex. -r). Multiple options can be used in a single command by spacing between each option (ex. ls -l -r).

Note: options can be case-sensitive, -r and -R are not the same to xterm; this can give unexpected results.

Common xterm Commands

cd              command alone will navigate to the root directory, add a path to navigate to a specific folder (ex. cd /etc/Groovix/)
clear           clears the screen of previous information
cp              make a copy of a file
eject           ejects a CD-ROM or removable device
exit             closes an xterm window (also used to log out of an SSH session)
ifconfig        displays network adapters and their properties
ls                lists files and folders in the current directory
more           outputs large file contents one page at a time, spacebar will advance one page until finished
mv              move a file
ping            pings a system Note: filtered webs will not respond
rm              delete a file
shutdown    shuts down the computer (requires a time) (-r option to reboot, -h option to halt)
su              switch user
xkill            changes the mouse cursor to an x, click on a window to close that window/program

Copy and Paste

To copy text in an xterm window, highlight the information to be copied and click the middle mouse button at the end of the highlighted text. To paste text in an xterm window, click the middle mouse button, the text will be pasted wherever the cursor is.

xterm Tips: - the up and down arrows cycle through previously entered commands - the tab key will auto complete a file or folder name based on the first few characters typed.

Editing text files

There are two types of text editors to use in xterm; vi and nano. To use nano, type nano [filename] where [filename] is the file you would like to open and press [ENTER].

The terminal screen will be replaced by the contents of the file, at the bottom (in red) are the commands available. Each command is represented by a ‘^’ and a letter (^ = CTRL); press both [CTRL] and the letter to perform that command. To quit the nano editor, press [CTRL+X]; if prompted to save changes press [Y] for yes, [N] for no. If yes is selected a path to the document is displayed, to save to another location type the path, otherwise, press enter to overwrite the file you are editing.

The vi editor is an advanced text editor, it is recommended to use nano unless you are familiar with vi. To use vi, type vi [filename] where [filename] is the file you would like to open and press [ENTER]. To quit the vi editor type :q and press [ENTER].

Killing a program

The ‘kill’ command is used to forcefully end a process that is not responding. Technicians can kill the inactivity or session timer(s) when working on a particular workstation and don’t want to be bothered with timers or pop-ups.

To kill a program you must first find the process id (PID), type the following command(s) to receive a list of processes and their PIDs use the command ‘ps aux | grep cmon_’ , ‘ps aux | grep pacrez_’. The first column is the user running the process, the second column is the PID. To kill a particular process type kill [pid], if the process refuses, type kill -9 [pid] for a more forceful attempt.

To kill just the inactivity timer, type kill xautolock, type kill pacrez to kill the session timer.

Killing a program in the Groovix GUI

If you can’t find the PID or have the process you want to kill open in the desktop, open a new xterm window and type xkill; this will change the mouse cursor to an X and will kill the first process window you click on with your mouse.