Difference between revisions of "Terminal Guide"

From GroovixWiki
Jump to: navigation, search
(Created page with "<div class="dashed-box">Note: The terminal interface can be a very powerful tool, it is recommended for advanced technicians that are comfortable working with a 'Command Line Int...")
 
m (Protected "Terminal Guide" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
(No difference)

Revision as of 22:24, 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 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, log in as the root user. 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@LBPW01). In this example, the current user is gvuser. To change which user is logged in, type ‘su’, a space, the user to log in as (ex. ‘su root’) and press enter; login 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 (ex. clear ; ifconfig).

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 timeframe, ‘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 are case-sensitive, -r and -R are not the same and 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 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 will reboot) su switch user xkill changes the mouse cursor to an x, click on a window to close that window/program

Copy and Paste in xterm: 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.

Note: while copying in PuTTY works just like xterm, pasting does not. To paste in PuTTY, right click the mouse.

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.


Section 6.2: Editing text files in xterm There are two types of text editors to use in xterm; vi and nano.

To use nano, type ‘nano’ followed by 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 the CTRL key 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.

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’ followed by the file you would like to open and press enter. To quit the vi editor type ‘:’ followed by q and press enter.

Section 6.3: Killing a program The ‘kill’ command is used to forcefully end a process that is not responding. Systems 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.

Killing a process in xterm: 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: ‘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.