Subscribe | Contacts | Feedback
           
Novell's GroupWise 6.5 Administrator's Guide   Use this site to gain access to up-to-date, relevant, technical resources that will help you optimize and improve your GroupWise messaging infrastructure          
             
    Sample Chapter  
               
    Feedback  
               
    Author's Bio  
               
  Success with GroupWise 6.5 for Linux  
   
   
   
   
                 
 
     
 

Basic Linux Commands

Note: This primer is an expansion of the Linux Primer that is included in the article “Simple Steps to Implementing GroupWise 6.5 For Linux”. This article can be found in the 2004 March/April issue of Novell Connection Magazine.

Just as soon as you begin learning Linux, particularly if you are a systems administrator, you will need to learn how to navigate through Linux at a “terminal/shell” session. Inside a terminal prompt you issue commands to the Linux operating system. A terminal session is very much like a DOS prompt. However Linux has significantly more utilities than you would use at the terminal prompt.

All installations of Linux have a terminal solution of some sort. Most GUI installations of Linux place an icon for a terminal prompt in a very noticable place. For example on a SUSE LINUX Professional 9.0 distribution with a KDE Desktop, the icon for a terminal/shell session is right on the toolbar at the bottom of the screen. It looks like a shell in front of a computer screen, as shown in Figure 1 below.


Figure 1

On a Redhat Linux 7.2 distribution with a GNOME desktop, the icon for a terminal/shell session is right on the toolbar at the bottom of the screen. It looks like a footprint in front of a computer screen as shown in Figure 2 below.


Figure 2

Important Note: Linux is case sensitive. So you when you run commands or deal with files, make sure to keep case sensitivity in mind.

Following is a table of the basic commands that you will need immediately when administering Linux. These commands are executed within a terminal/shell prompt.

Common Linux terminal/shell Commands
Task Command Example DOS Equivalent
list the contents of a directory ls List all files in a directory: ls
List all files in a directory which start with “gw”: ls gw*
List all files and their sizes in a directory: ls –s
List files in a directory with verbose information about the files: ls -la
dir
or
dir gw*
print the name of the current working directory pwd print the name of the current working directory: pwd chdir
change directory cd Change to the root directory: cd /
Change to the /etc directory: cd /etc
cd or cd etc
make a directory mkdir

Make a directory called “dir1”: mkdir dir1

md dir1
delete/remove a directory rmdir Delete or remove a directory called “dir1”:
rmdir dir1
rd dir1
read a file and display it on the screen cat View the contents of file.txt: cat file.txt
The file has a lot of text that scrolls by and you want to view it screen by screen: cat file.txt | more
type or
type file.txt | more
find a file or directory find Find the “file2.txt” file that is located somewhere on your Linux server: find / -name file2.txt
Find the “Novell” directory that is located somewhere on your Linux server: find / -name Novell
No direct equivalent DOS command
move a file to a new path mv Move the “file.txt” file from the
/temp directory to the /etc directory:
mv /temp/file.txt /etc

move file.txt c:\temp
rename a file mv Rename the “file.txt” file to “TESt1.txt”:
mv file.txt TESt1.txt
ren file.txt test.txt
delete/remove a file rm Delete/remove “file.txt”: rm file.txt
del file.txt
break out of a process Ctrl-c You used a command and now you want to break out of it: Hold down the Ctrl key and the c key. Ctrl-c
clear the screen clear Clear the current terminal screen: clear cls
find a command that will help you to do something, but you don’t know the name of the command apropos Find commands related to creating a zip file:
apropos zip
The help command is somewhat like apropos
print help information regarding a command -help Many shell-based utilities (not all) will print a help screen by adding the -help switch to the end of the command. For example:
ls -help
/?
Sometimes there’s just too much information or text coming at you. The “grep” command helps you filter the information. (See example) grep Find commands related to zip files, but with specific mention to “gz”: apropos zip | grep gz
No direct equivalent DOS command
copy a file to another location. cp Copy file.txt from the current location to the /usr/local directory: cp file.txt /usr/local copy
Quickly view a text file more View the file called file.txt. Use the Enter key to advance through the file, and the Ctrl-c key sequence to break out of viewing the file. Here’s the syntax for viewing a file: more file.txt
type file.txt | more

Running Programs in Linux

Like most operating systems Linux has search paths. If you want to know the search paths in your Linux installation, you can type the following command at a terminal/shell prompt:

set

Look for the “path=” statement, and you will generally see a lot of different paths stated after the “path=” statement.

Programs that are in the search path can be executed from a terminal session independent of what directory you are in. However if you want to execute a piece of software that is not in the search path you must indicate the path to the executable. For example, let's say I'm in the /usr/home directory, but I want to exectue a shell script in the /temp directory called “run.sh”. Here is the command I would use:

/temp/run.sh

Even if my current location were the /temp folder, I still need to indicate that the path to the folder that I am in order to execute the run.sh file. The “.” (period) character stands for the current directory. So if I am currently in the /temp directory, and I want to execute the “run.sh” file I would use the following syntax:

./run.sh

Sometimes you might download a file, but you cannot execute the file. Generally this means you must “change the mode” of the file so that the Linux will allow the file to be executed. You can use the “chmod” utility to do this. With the following command you can change the mode of a file called “script1.sh” so that it can be executed:

chmod 755 script1.sh

Issuing the chmod command above tells Linux to allow the file to be executed.

Many programs in Linux do not have a user interface. So if you happen to load a process, and you want to determine whether the process is running, then you can use the “ps” command. For example:

ps -eaf

Most likely there will be many processes will fly by, you may want to pipe the information to more utility. For example:

ps -eaf | more

Working with *.TAR.GZ Files

The gzip utility can zip and unzip *.tar.gz files. After running the gzip utility to decompress a file with a *.tar.gz extension, the file will be called <filename>.tar. The file must then extracted from it’s *.tar format using the utility called “tar” which is explained next. Here’s an example of how to use gzip to decompress a *.tar.gz file:

gzip –d java2.1.tar.gz

Note: The –d argument instructs gzip to decompress the *.tar.gz file.

Working with *.TAR files

The *.tar (tape archive) format is a popular format in the Linux/Unix world. A file with a *.tar extension is one file that usually has more than one file within it. But *.tar files are are not smaller than the total size of the files within the *.tar file. So often a file that has been “tarred” is then compressed via gzip. At that point the *.tar file becomes a “*.tar.gz” file. Here’s the command to untar a *.tar file:

tar –xvf java2.1.tar

The argument “x” means extract. The argument “v” means be verbose while processing the *.tar file. The argument “f” basically means to extract the contents of the *.tar file specified just after the “f” argument.

Working with *.RPM Installation Files

The *.rpm file extension is an installation file that complies with the very popular Linux installation standard called Redhat Package Manager. All of the installation routines and software to be installed are contained within the *.rpm file. Following is an example command line to process a *.rpm file:

rpm –ivh groupwise-gwclient-6.5.1-i386.rpm

The argument “i” means install. The argument “v” means be verbose while processing the *.rpm file. The argument “h” means while the rpm is installing the software it should indicate the installation progress by displaying hash marks (pound symbols).

Sometimes you might have installed the software before, and you want to re-install it. By default the rpm utility won't allow that. If you try to run rpm and it reports that you cannot install the software because of a prior installation, you can use the --force argument (that's a double dash). Here is an example of incorporating the --force argument with rpm:

rpm –ivh --force groupwise-gwclient-6.5.1-i386.rpm

Working with *.BIN Installation Files

Although the *.rpm installation file format is popular (as explained in the previous section) sometimes you will have installation files with a *.bin extenson. These type of installation files do not need an install utility, they just need to be run like any other exectuable. For example if I have the file”j2sdk-1_4_2-nb-3_5_1-bin-linux.bin” in my temp directory, and I am currently in the temp directory I would use the following command to execute the file:

./j2sdk-1_4_2-nb-3_5_1-bin-linux.bin

The installation behavior of a *.bin file is up to the manufacturer of the bin file. So the instllation behaviour you get from a *.bin file will necessarily be consistent.

There you have it. There are so many more commands in Linux, but this list is enough to help you get really comfortable with Linux. I have perused several Linux books, and purchased three. By far the one that I like the most is the O'Reilly book Linux In A Nutshell by Siever, Figgins& Weber.