Difference between revisions of "Terminal Guide"

From GroovixWiki
Jump to: navigation, search
m (Protected "Terminal Guide" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
Line 1: Line 1:
 
<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 Interface'.</div>
 
<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 Interface'.</div>
  
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.
+
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, 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@inet-7). To change which user is logged in, type <font class="code">su root</font> and press '''[ENTER]'''; login will be successful once the password for that user is entered.
  
 
== Using Commands ==
 
== 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).
+
Commands follow a simple structure that must be followed to execute the command properly, <font class="code">[command] [option(s)] [*]</font>. 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.
+
''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’).
+
* Some commands require extra information such as a time or path, these come after any options. For example, the <font class="code">shutdown</font> command requires a time indicated for when the shutdown should occur (ex. <font class="code">shutdown -r now</font>).
  
Using Options:
+
== 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).
+
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. <font class="code">ls -l -r</font>).
  
Note: options are case-sensitive, -r and -R are not the same and can give unexpected results.
+
''Note: options can be case-sensitive, -r and -R are not the same to xterm; this can give unexpected results.''
  
Common xterm Commands:
+
== 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/)
+
cd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command alone will navigate to the root directory, add a path to navigate to a specific folder (ex. cd /etc/Groovix/)<br />
clear clears the screen
+
clear&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clears the screen of previous information<br />
cp make a copy of a file
+
cp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;make a copy of a file<br />
eject ejects a CD-ROM or removable device
+
eject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ejects a CD-ROM or removable device<br />
exit closes an xterm window (also used to log out of an SSH session)
+
exit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closes an xterm window (also used to log out of an SSH session)<br />
ifconfig displays network adapters and their properties
+
ifconfig&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;displays network adapters and their properties<br />
ls lists files and folders in the current directory
+
ls&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lists files and folders in the current directory<br />
more outputs large file contents one page at a time, spacebar will advance one page until finished
+
more&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputs large file contents one page at a time, spacebar will advance one page until finished<br />
mv move a file
+
mv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move a file<br />
ping pings a system Note: filtered webs will not respond
+
ping&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pings a system ''Note: filtered webs will not respond'' <br />
rm delete a file
+
rm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete a file<br />
shutdown shuts down the computer (requires a time) (-r option will reboot)
+
shutdown&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shuts down the computer (requires a time) (-r option will reboot)<br />
su switch user
+
su&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch user<br />
xkill changes the mouse cursor to an x, click on a window to close that window/program
+
xkill&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 />
  
 
Copy and Paste in xterm:
 
Copy and Paste in xterm:

Revision as of 22:36, 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, 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@inet-7). To change which user is logged in, type 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.

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 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.