Académique Documents
Professionnel Documents
Culture Documents
1.1 Logging in
When no one is “logged in”, a welcome window is displayed as:
Schlumberger Private
• Enter the username name given to you by the system administrator or your instructor and
press the “Enter” key on the keyboard.
• The system will request you to enter the password as shown above.
Enter the password, provided to you by the system administrator or your instructor, in the
space, as shown in the illustration above and press Enter. (If your account does not have a
password assigned to it, the system logs you without asking you for password).
Note: the system does not display (echo) your password on the screen as you type it. This is to
prevent others from discovering your password.
1
1.2 How to open a terminal window
A terminal window is a window in which you can work in command line mode of Unix. To
open an XTerminal window, click on the right button of the mouse (MB3). A scroll menu
will appear. Choose the “Programs” submenu, then select: “Terminal…” (MB3 > Programs
> Terminal).
Schlumberger Private
1.4 Logging out
When you finish your work session and are ready to exit the operating system, click on the
right button of the mouse, you’ll obtain a menu. Choose the “Log out…” option in order to
log out of the system. The system will ask you for a confirmation, click OK.
After a moment, the system once again displays the Welcome window indicating that you
successfully logged out. The system is now ready for you or another user to log in.
The following section explains the commands available for creating, listing, copying, moving
and deleting files. You’ll also see how to list the contents of a file and how to determine the
nature of a file.
2
2.1 Using File commands
Schlumberger Private
> pwd
/diske/student5
In this example, the user’s home directory is /diske/student5, where “student5” is the name of
the user owning the home directory.
3
2.1.4 Copying files (cp)
Use the cp command to copy tempfile to a file called copyfile
> cp tempfile copyfile
If you now want to list the contents of the directory, the command ls *file should list both
tempfile and copyfile (and any other file in this directory with a name that end with file).
> ls *file
copyfile tempfile
Schlumberger Private
2.1.5 Moving and renaming files (mv)
You can both move and rename files using the same command, mv (move). In this example,
use the mv command to rename tempfile to emptyfile:
> mv tempfile emptyfile
Note: Deletes files cannot be restored unless you have a backup containing the original files.
4
2.1.7 Displaying file contents (more, cat)
Use the more command to display the contents of a file. Type more followed by the name of
the file to be displayed. The contents of the file scrolls down the screen. If the file is longer
than one screen, this message appears:
--More—(nn%) [Press space to continue, ‘q’ to quit. ]
Schlumberger Private
2.1.8 Displaying file type (file)
Use the file command to show the file type:
> file emptyfile
emptyfile: ascii text
/ (Root)
5
2.1.11 Print working directory
The command pwd (print working directory) tells you your current directory:
> pwd
/diske/student5
Schlumberger Private
> cd /usr/lib
> pwd
/usr/lib
When you type the cd command by itself, you return to your home directory. For example, if
your home directory was /diske/student5:
> cd
> pwd
/diske/student5
In the C shell, the tilde (~) is used as shortcut for specifying your home directory. For
example, you would type the following to change the subdirectory music within your home
directory:
> cd ~/music
You can also use this shortcut to specify another user’s home directory. For example:
> cd ~username
Where username is another user’s login name, would change to that user’s home directory.
6
2.1.13 Creating directory (mkdir)
It is easy to create a new directory. Type the mkdir command followed by the name of the
new directory:
> mkdir data
> cd data
> mkdir geoframe
> cd geoframe
> pwd
/diske/student5/data/geoframe
Schlumberger Private
2.1.14 Moving and renaming directories
You rename a directory by moving it to a different name. Use the mv command to rename
directories:
> pwd
/diske/student5/data
> ls
geoframe
> mv geoframe eclipse
> ls
eclipse
In this example, the directory eclipse is moved from data to data1 with the mv command.
7
2.1.15 Copying directories
Use the cp –r command to copy directories and the files they contain:
> cp –r data data2
This command copy all file and subdirectories within the directory data to a new directory
data2. This is a recursive copy, as designated by the –r option. If you attempt to copy a
directory without using this option, you will see an error message.
Schlumberger Private
To remove a directory, use the rmdir command as follow:
> rmdir data2
if the directory still contains files or subdirectories, the rmdir command will not remove the
directory.
The rm –r (adding the recursive option –r to the rm command) to remove a directory and all
its contents, including any subdirectories and their files, as follow:
> rm –r data2
Caution: Directories removed with the rmdir command cannot be recovered, nor can
directories and their contents removed with the rm –r command.
8
Other options include:
- name filename
Selects files whose rightmost component matches filename.
-user userid
Selects files owned by userid. userid can be either a login name or a user ID number
- group group
Selects files belonging to group
- m time n
Selects files that have been modified within n days
Schlumberger Private
2.1.18 File and directory security
These are the basic file and directory permission type:
• r: read permission. A file must be readable to be examined or copied. A directory must be
readable for you to list its contents.
• w: Write permission. A file must be writable in order for you to modify it, remove it or
rename it. A directory must be writable for you add or delete files in it.
• x: Execute permission: A file with executable permissions is one you can run, such as
program. A directory must be executable for you to gain access to any of its
subdirectories.
There are 3 categories of users for which you can set permissions:
• Self: the user
• Group: Other users within the same group as the user (for example, all accounting users).
Groups are established and maintained by the system administrator.
• Others: Everyone else
9
/diske/student5
> ls –l
total 8
drwxr--r-- 2 student5 1024 Jan 7 11:45 data
drwxr--r-- 2 student5 1024 Jan 7 12:30 data1
-rw-r--r-- 2 student5 0 Jan 7 11:30 emptyfile
Permissions Links Owner Size Date Time File or directory name
The first character on the line indicates the file type. A “-“ (hyphen) is an ordinary file;
Schlumberger Private
d indicates a directory, and other characters indicate other special file types.
The next nine characters indicate the permissions of the file or directory. The nine characters
consist of three groups of three, showing the permissions for owner, the owner’s group and
the world, respectively. The permissions for emptyfile are rw-r- -r- -, indicating that the
owner can read and write this file, everyone can read it and no one can execute it. The
permission for directory data1 are rwxr-xr-x, indicating that everyone has read and execute
permissions, but only the owner can write to it.
In addition to file permissions, the display shows the following information:
• Number of links to this file or directory
• Name of the owner (student5 in this case)
• Number of bytes (characters) in the file
• Date and time the file or directory was updated
• Name of the file or directory
10
2.1.20 Listing hidden files (ls –a)
There are some files that are not listed by the ordinary ls command. These files haves names
beginning with the character . (called “dot”), such as “.cshrc”, “.login”, “.profile”. Use the
ls –a command to list these files:
> ls –a
.
..
.cshrc
.login
Schlumberger Private
.profile
emptyfile
Notice that the files beginning with “ .” are listed before the other files. There are two special
files in this listing: the file “ .” is the reference for the current directory, and the file “ ..” is
the reference for the parent directory.
Where permissions indicates the permissions to be changed and filename is the name of the
affected file or directory.
The permissions can be specified in several ways. Here is one of the forms which is easiest to
use:
1. Use one or more letters indicating the users involved:
• u (for the user)
• g (for the group of users)
• o (for other users)
• a (for all three or above categories)
11
2. Indicate whether the permissions are to be added (+) or removed (-).
3. Use one or more letters indicating the permissions involved.
• r (for read)
• w (for write)
• x (for execute)
In the following example, write permission is added to the directory
> ls –l eclipse
drwxr-xr-x 3 student5 1024 Jan 7 11:30 eclipse
> chmod g+w eclipse
Schlumberger Private
> ls –l eclipse
drwxrwxr-x 3 student5 1024 Jan 7 11:30 eclipse
As you can see, the hyphen (-) in the set of characters for group is changed to a w as a result
of this command.
To make this directory non-readable and non-executable by the other users outside your group
(permissions is o-rx), you would enter the following:
> ls –l eclipse
drwxrwxr-x 3 student5 1024 Jan 7 11:30 eclipse
> chmod o-rx eclipse
> ls –l eclipse
drwxrwx--- 3 student5 1024 Jan 7 11:30 eclipse
Now, the r (for read) and the x (for execute) in the set of characters for others users are both
changed into hyphens.
When you create a new file or directory, the system automatically assigns permissions. In
general the default settings for a file are: -rw-r --r--
And for new directories are: drwxr-xr-x
12
So, to make a new file test executable by its owner (student5), you would enter the following:
> ls –l test
-rw-r--r-- 3 student5 1024 Jan 7 11:30 test
> chmod u+x test
> ls -l
-rwxr--r-- 3 student5 1024 Jan 7 11:30 test
Schlumberger Private
Up to this point, the discussion on permissions has only included using the chmod command
to change permissions relative to their current settings. Using a different form of the chmod
command, which applies numeric codes to specify permissions, you can set the permissions
for a file or directory absolutely.
The syntax for this usage of chmod command is:
Where numcode is the numeric code and name is the name of file or directory for which you
are changing permissions.
The complete numeric code consists of three numbers. One number is used for each of the
three categories: user, group and other. For example, the following command sets absolute
read, write and execute permissions for the user and the group, and execute permissions only
for others:
> chmod 771 test
The following table illustrates how the permissions described for test are represented by the
code 7 7 1.
Permissions for test
Permission User Group Others
Read 4 4 0
Write 2 2 0
Execute 1 1 1
Total 7 7 1
13
The following is another example of this method for setting absolute permissions, with the
ls –l command to demonstrate the results:
> ls –l test1
-rw-r--r-- 3 student5 1024 Jan 7 11:30 test1
> chmod 755 test1
> ls –l test1
-rwxr-xr-x 3 student5 1024 Jan 7 11:30 test1
Schlumberger Private
3 Searching files
Where string is the word or phrase you want to find, and file is the file to be searched.
For example, to find the phone number of the user student4 (this information is stored in the
test file)
> grep student5 test
student5 021 656666
Note that more than one line may match the pattern you give:
> grep student test
student1 021 616666
student2 021 626666
student3 021 636666
student4 021 646666
student5 021 656666
grep is case-sensitive; that is, you must match the pattern with respect to uppercase and
lowercase letters:
14
3.1.1 Filtering using “grep”
The following example displays files ending in “.tmp” that were created in the month of May:
> ls –l *.tmp |grep May
Schlumberger Private
-rw-r--r-- 1 student5 1067 Apr 12:45 commandos.tmp
the second part, “|grep May” pipes that list through grep, looking for the pattern May:
> ls –l *.tmp | grep May
-rw-r--r-- 1 student5 2356 May 16:05 clock.tmp
-rw-r--r-- 1 student5 1567 May 16:15 cmdtool.tmp
grep can search for a string in a group of files. When it finds a pattern that matches in more
than one file, it prints the name of the file, followed by a colon, then the line matching the
pattern:
> grep student5 *
test: student5 021 616666
test1:student5 Malika
15
4 Print command
This section presents the most common print commands.
Schlumberger Private
file_name: is the name of the file you want to print.
Example:
> lp –d hp4mv test
request id is hp4mv-408 (1 file(s))
And use lpstat –o all in order to check the status of all print jobs (all users) as follows:
> lpstat –o all
hp4mv-408 berkine!student5 2001 Jan 7 11:45
hp4mv-409 berkine!root 2001 Jan 7 11:46
16
4.3 How to cancel a print job
Use the cancel command in order to cancel a job as follows:
> cancel hp4mv-408
Where: hp4mv-408 is the request ID of the file you want to cancel (here it is the id of the file
test)
Schlumberger Private
5.1 Using a password
When choosing a password, keep the following in mind:
• Choose a password that you can remember without writing it down. A password that you
can’t remember is worse than one that is too easily guessed.
• Choose a password that is at least six characters long and contains at least one number.
• Don’t use your own name or initials or name or initials of your spouse.
• Don’t use the names or pets or objects common to your interests.
• Don’t use all capital letters
1. When the system prompts you for old password, type your current password.
If no password is currently assigned to your account, the system will skip the old password
prompt. Note that the system does not echo your password on the screen. This prevents other
users front discovering your password.
17
2. When the system prompts you for new password, type the password you’ve decided on.
Again the password you type does not echo on the screen.
3. At the final prompt, Retype new password:, type your new password second time. This is
to verify that you typed exactly what you intended to type.
Schlumberger Private
5.2.1 Terminating processes using “kill”
The kill command provides you a direct way to stop command processes that you no longer
want. This is particularly useful when you make a mistake typing a command that takes a long
time to run.
To terminate a process:
1. Type ps to find out the PID(s) for the process(es).
2. Type kill followed by the PID(s).
Note that a faster way of determining the right PID is to pipe ps output through grep as
follow:
> ps | grep commandname
18
Where commandname is the name of the command process you want to stop.
If you need to forcibly terminate a process, you can use the –9 option with the kill command
as follow:
> kill –9 PID
Where PID is the process identification number of the process you want to terminate (kill).
Schlumberger Private
5.3.1 Displaying disk usage “df –k”
df –k shows you the amount of space currently in use on each disk that is mounted (directly
accessible) to your system. Just type:
> df -k
to see the capacity of each disk mounted on your system, the amount available and the
percentage of space already in use.
N.B. File systems at or above 90 percent should be cleared of unnecessary files. You can do
this either by moving them to a disk or a tape that is less full, using cp to copy them and rm to
remove them, or you can simply remove them outright. Of course, you should only perform
these housekeeping tasks on files that you own.
19
6 Handling tape devices
In the following, we will user /dev/rmt/0 as the tape device path, but you should ask your
system administrator in order to obtain the device path corresponding to the tape drive you
want to use.
Schlumberger Private
0l Meaning low density (2GB) writing to the tape
0m Meaning medium density (5GB) writing to the tape
0h Meaning high density (7GB) writing to the tape
0u Meaning compressed (10GB if 120m tape; 14 GB if 160m tape length)
0n Meaning no automatic rewind
0b Meaning to follow Berkley standard for EOT (end of tape)
Marker and EOF (end of file) marker assuming our tape device is
/dev/rmt/0
This forwards the tape 3 files ahead and stops at the beginning of the 4th file. It is useful in
dealing with tapes containing multiple files.
Note: The n for no rewind was important here so that the tape does not auto rewind to the
beginning of the tape after skipping the 3 files.
20
This gives the current status of the tape drive.
Schlumberger Private
6.2 Backup using “tar” command
To create a backup file on a tape of a directory or a file we use the tar command as follows:
tar cvf /dev/rmt/0 directoy_name
Or
tar cvf /dev/rmt/0 file_name
Also you can have several files or directories or a mixture between both by mentioning this in
the command line as follows:
tar cvf /dev/rmt/0 directory_name1 [file_name1]….[directory_name4]
Note: It is better to go to the location of the file or directory which is to be backed-up rather
than mentioning the full pathname for that file or directory; because if mentioned the
pathname you will be obliged whenever you restore your backed data that this location exists,
and you will be limited to just restoring to this location.
21
to restore a specific file from a tape
tar xvf /dev/rmt/0
to restore the whole backup file from the tape
Schlumberger Private
tcopy source destination
Note: The file file_name must exist, this could be done by using the touch command to create
a file even if a zero-size file as previously mentioned:
touch file_name
22
7.3 The wc command
This acts as a counter command, it gives counts for words, characters and lines in the
specified file, for example:
wc –w file_name gives the number of words in the specified file
wc –l file_name gives the number of lines for the specified file
wc –c file_name gives the number of characters in the specified file
Schlumberger Private
7.4 The cut command
This cuts out selected fields of each line in the file. For example, if we have the file employee
as follows:
> cat employee
Name: Job_title:Salary:Location
Tom:Engineer:3500:Egypt
John:Accountant:4000:Italy
Henry:Manager:5000:Germany
Terry:Technician:2500:France
Then we want to get only the employee_name & location we can apply:
> cut –d: -f1,4 employee
Name: Location
Tom: Egypt
John: Italy
Henry: Germany
Terry: France
Here we mentioned that our delimiter is a colon “-d:”, and we want only first and fourth fields
“f1,4”.
We can also specify a range of characters where we want to apply the cut command for
example:
> cut –c1-20 employee
23
Name:Job_title:Salar
Tom:Engineer:3500:Eg
John:Accountant:4000
Henry:Manager:5000:G
Terry:Technician:250
Here we mentioned that we wanted the first 20 characters out of every line.
Schlumberger Private
The xwd command enables us to capture a screen dump of an active window on a file like
follows:
xwd > file_name
A pointer like “+” will show. You should use this pointer to point to the window that you
would like to have a captures image of on the file file_name and then apply one click with
your left mouse button. You will hear one peep followed by 2 peeps to indicates that
capturing the image has been done.
To see how the captures image look like, you can apply the xwud command like this:
xwud < file_name
An image of the captured window will show. To remove it, click the left mouse button one
click.
24
8 Basic network commands
8.1 Objectives
Upon completion of this lesson, you’ll be able to:
• Describe the terms client-server and distributed processing
• Execute a command on another machine.
• Copy files from one machine to another machine
• Log in to another machine on the network
Schlumberger Private
• Work into a remote machine.
• Perform a backup into a remote tape drive.
8.2 Client-server
8.2.2 Server
A server is a machine that provides resources to one or more clients. A server connects to the
clients it serves by a network.
8.2.3 Client
A client is a machine that uses the services from one or more servers on a network.
8.2.4 Network
A network is a connection between machines that allows an exchange of information between
these machines. Three types of network are:
Local area network (LAN)
A LAN is a network that covers a small area, usually less than a few thousand feet.
Metropolitan area network (MAN)
A MAN is a network that can span across a city
Wide area network (Wan)
A WAN is a network that can span thousand of miles
25
8.3 The /etc/hosts file
Before using any network resource, you should know that for each entity connected to the
network corresponds an IP address. The /etc/hosts file contains these correspondences (you
can view it by typing the following command “pg /etc/hosts”)
Schlumberger Private
Command format:
rsh hostname [command]
Example:
Use the rsh command to look for specific information on another host rather than remotely
logging in to look for it.
26
5. Once the file is copied (after the message of success), type “bye” in order to close the ftp
session
Note: If you want to copy more than one file you should replace the 4 th instruction by the
following:
mput file_name1 file_name2….
Or: mput *
And then, the system will ask you to choose the files you want to copy.
Schlumberger Private
In order to copy file(s) from another machine to your machine, follow these instructions:
1. Change to the directory to which you want to copy file(s).
2. Execute the command “ftp remote_name”, where remote_name is the name of the remote
machine you want to copy file(s) on. The system will ask you to enter the username and
the password you want to connect with.
3. Change to the directory you want to copy from (cd directory_name)
4. Execute the command “get file_name”, where file_name is the name of the file you want
to copy
5. Once the file is copied (after the message of success), type “bye” in order to close the ftp
session
Note: If you want to copy more than one file you should replace the 4th instruction by the
following:
mget file_name1 file_name2….
Or: mget *
And then, the system will ask you to choose the files you want to copy.
Note: When users copy files between systems, the files retain the ownership of the UID who
executed the command.
27
8.6 Log in to another machine
Before attempting to remotely log in to another system as a different user, be sure you have an
account on the remote machine you want to access. If not, check with your system
administrator.
The pertinent information is:
• Machine name
• Login ID
• Password
Remotely logging into workstation is helpful under the following circumstances:
Schlumberger Private
• To access information on another workstation that not available otherwise.
• To access your workstation to read mail
• To access your workstation to kill a process that has caused it to hang.
Example:
Use rlogin command to establish a remote session on “berkine” the remote machine, with
your current login ID on your current local workstation.
Use the “rlogin –l” to specify a different login ID for your remote login session.
Command format:
rlogin machinename -l username
28
Example:
> rlogin berkine -l user5
Password:
Last login Sat 6 16:00 berkine
Sun Microsystems Inc. SunOs 5.6 Generic august 1997
You have a new mail
Schlumberger Private
Use the telnet command to start a new login session to a remote machine with the login id you
specify at the “Login” prompt.
Command format:
telnet machinename
Example:
> telnet berkine
Login: user5
Password:
Last login Sat 6 16:00 berkine
Sun Microsystems Inc. SunOs 5.6 Generic August 1997
You have a new mail
29
8.8 Using a remote tape drive
When having a network, this gives variety of benefits. One of which is using resources on
remote networked machines like in our case here the tape drive.
Consider having two machines:
“local” the current machine we are using
“remote” the remote machine with tape drive “/dev/rmt/0”
Schlumberger Private
This could be done using the rsh command like this:
Where obs is the output block size; we chose 20b because this is the standard default when
making a tar on a tape drive.
Where ibs is the input block size; we chose 1000b just a big number to make the read process
mach faster by reading larger blocks.
30
9 Additional information
Schlumberger Private
The current environment variables are displayed with the "printenv" command. Some
common ones are:
DISPLAY The graphical display to use, e.g. ainsalah:0.0
HOME Path to your home directory, e.g. /diske/student5
HOST The hostname of your system, e.g. ainsalah
PATH Paths to be searched for commands, e.g. /usr/bin:/usr/ucb:/usr/local/bin
USER Your username, e.g. student5
Many environment variables will be set automatically when you login. You can modify them
or define others with entries in your startup files or at anytime within the shell.
• To set or modify an environment variable, use this syntax:
> setenv NAME value
• You can unset an environment variable with the unsetenv command as follows:
> unsetenv NAME
• You can access to current value of the variable via the "$NAME", or "${NAME}",
notation.
Example:
> setenv PATH $PATH:/diske/student4
31
9.3 Using the manual pages of Unix (man)
The man command is used in order to give information about the way you should use a
specific command. This command is very useful in order to remind a command syntax.
Command format: man command_name
Example:
> man man
Schlumberger Private
32
Schlumberger Private
APPENDIX
Using the “vi” editor
33
Introducing vi
The visual display (vi editor) is an interactive editor that is used to create and/or modify text
files.
The vi editor uses a screen display, but you cannot use the mouse to position the cursor.
It is important that users know how to use vi editor, as it is sometimes the only editor
available (besides ed).
“vi” modes
There are three modes of operation in vi:
Schlumberger Private
• Command mode
• Entry mode
• Last-line mode
When you open a file with vi, you are in command mode. In this mode, you can enter
positioning and editing commands to perform functions. While in command mode you can do
advanced editing commands by typing a colon (:), which places you at the bottom line of the
file. This is called last-line mode. However, all commands are initiated from command mode
You must be in entry mode to enter text. To enter text you must type a vi insert command
such as i or a. This takes vi out of command mode and puts it into entry mode. In this mode,
text will not be interpreted as editing commands. When you finish entering text in your file,
press the Esc key to return to command mode.
Invoking vi
Command format:
vi [filename]
Example:
To create a new file, invoke vi with a new file name by typing:
> vi filename
34
The following table contains commands you can use to create, edit or view a file.
Command Meaning
vi filename Open or create file
vi Open new file to be named later
vi –r filename Recover crashed file
view filename Open file read-only
Input commands
Command Meaning
a Append text after cursor
A Append text at line end
i Insert text before cursor
Schlumberger Private
I Insert text at beginning of line
o Open a new line below cursor
O Open a new line above cursor
35
Editing Command
Deleting text
To delete text, use the following options:
Command Meaning
x Delete character at the cursor
X Delete character to the left of the cursor
dw Delete word (or part of word to right of cursor)
3dw Delete 3 words
dd Delete the line containing the cursor
3dd Delete 3 lines
D Delete the rest of the line right of the cursor (from cursor
Schlumberger Private
position to the end of the line)
dG Delete to end of file
dlG Delete from beginning of the file to cursor
:5,10d Delete lines 5 through 10
36
:u Previous last line command
Schlumberger Private
Note: Both delete and yank write to a buffer. When yanking and pasting, the paste commands
insert the text differently depending on whether you are pasting a word(s) or a line(s).
The set commands are used from last-line to control these options
Command Meaning
:set nu Show line number
:set nonu Hide line number
:set ic Searches should ignore case
:set noic Search should be case sensitive
:set list Display invisible characters such as tab and end of line
:set nolist Turn off the display of invisible characters
:set showmode Display current mode of operation
:set noshowmode Turn off I-node display
37
To find a line, use the following options:
Command Meaning
G Go to last line of file
1G Go to first line of file
:21 Go to line 21
21G Go to line 21
To clear the screen and insert a file, use the following options:
Command Meaning
Schlumberger Private
Control-L Clear (refresh) scrambled screen
:r filename Insert (read) file at line after cursor
:34 r filename Insert file after line 34
38
Schlumberger Private
39
Index
1 Logging into SunOS...............................................................................................................1
1.1 Logging in.........................................................................................................................1
1.2 How to open a terminal window.......................................................................................2
1.3 How to close a terminal window.......................................................................................2
1.4 Logging out......................................................................................................................2
2 Working with files and directories.......................................................................................2
2.1 Using File commands........................................................................................................3
Schlumberger Private
2.1.1 Before you begin........................................................................................................3
2.1.2 Creating a test file......................................................................................................3
2.1.3 Listing files (ls)..........................................................................................................3
2.1.4 Copying files (cp).......................................................................................................4
2.1.5 Moving and renaming files (mv)...............................................................................4
2.1.6 Deleting files (rm)......................................................................................................4
2.1.7 Displaying file contents (more, cat)...........................................................................5
2.1.8 Displaying file type (file)...........................................................................................5
2.1.9 Directories and hierarchy...........................................................................................5
2.1.10 Directory hierarchy..................................................................................................5
2.1.11 Print working directory............................................................................................6
2.1.12 Change working directory (cd)................................................................................6
2.1.13 Creating directory (mkdir).......................................................................................7
2.1.14 Moving and renaming directories ...........................................................................7
2.1.15 Copying directories..................................................................................................8
2.1.16 Removing directories (rmdir)...................................................................................8
2.1.17 Looking files (find)..................................................................................................8
2.1.18 File and directory security........................................................................................9
2.1.19 Displaying permission and status (ls –l)..................................................................9
2.1.20 Listing hidden files (ls –a).....................................................................................11
2.1.21 Changing permissions (chmod).............................................................................11
2.1.22 Setting absolute permissions..................................................................................13
3 Searching files.......................................................................................................................14
3.1 Searching for patterns with grep.....................................................................................14
3.1.1 Filtering using “grep”...............................................................................................15
3.1.2 “grep” with multi-word strings................................................................................15
4 Print command.....................................................................................................................16
4.1 How to submit a job (a file)............................................................................................16
4.2 How to show the status of a print job..............................................................................16
4.3 How to cancel a print job................................................................................................17
5 Passwords, processes, and disk storage..............................................................................17
5.1 Using a password............................................................................................................17
5.1.1 Changing your password..........................................................................................17
Schlumberger Private
5.2 Processes and PIDs.........................................................................................................18
5.2.1 Terminating processes using “kill”..........................................................................18
5.3 Managing disk storage....................................................................................................19
5.3.1 Displaying disk usage “df –k”.................................................................................19
5.3.2 Displaying directory usage (du)...............................................................................19
6 Handling tape devices..........................................................................................................20
6.1 The mt command............................................................................................................20
6.1.1 Rewinding a tape (using rew qualifier)....................................................................20
6.1.2 Forwarding a tape “n” files (using fsf qualifier)......................................................20
6.1.3 Checking a tape drive status (using stat qualifier)...................................................20
6.1.4 Rewinding and ejecting a tape (using rewoffl qualifier)..........................................21
6.2 Backup using “tar” command.........................................................................................21
6.3 Listing a backup file........................................................................................................21
6.4 Restore a backup file.......................................................................................................21
7 Some useful unix commands...............................................................................................22
7.1 The tcopy command........................................................................................................22
7.2 The dd command.............................................................................................................22
7.3 The wc command............................................................................................................23
7.4 The cut command............................................................................................................23
7.5 The xwd & xwud commands..........................................................................................24
8 Basic network commands....................................................................................................25
8.1 Objectives........................................................................................................................25
8.2 Client-server....................................................................................................................25
8.2.1 Distributed processing..............................................................................................25
8.2.2 Server.......................................................................................................................25
8.2.3 Client........................................................................................................................25
8.2.4 Network....................................................................................................................25
8.3 The /etc/hosts file............................................................................................................26
8.4 The rsh command............................................................................................................26
8.5 Using the ftp command...................................................................................................26
8.5.1 Copying file(s) to another machine..........................................................................26
8.5.2 Getting file(s) from another machine.......................................................................27
8.6 Log in to another machine..............................................................................................28
8.6.1 Using the rlogin command ......................................................................................28
Schlumberger Private
8.6.2 Using the telnet command........................................................................................29
8.7 Working in a remote machine.........................................................................................29
8.8 Using a remote tape drive...............................................................................................30
8.8.1 Baking up to a remote tape......................................................................................30
8.8.2 Restoring from a remote tape...................................................................................30
9 Additional information .......................................................................................................31
9.1 The startup files (.cshrc et .login)...................................................................................31
9.2 The environment variables..............................................................................................31
9.3 Using the manual pages of Unix (man)..........................................................................32
Appendix ……..………………………………………………………….…………………..33