Tutorial Linux Part III
1. Change Working Directory
The command
cd try_it
changes the directory try_it which path is given relative to the working directory. If the working directory is, for example, /home/smith then the working directory will become /home/smith/try_it
2. Moving in Directories
Command Meaning
cd try_it Change directory
pwd Print working directory (e.g. /home/smith/try_it)
cd .. Move to superior directory
pwd Print /home/smith
cd /home The absolute path
pwd Print /home
cd The system is returned to the user home directory
pwd Print /home/smith
3. Make Directory
The command
mkdir my_dir
makes new directory my_dir (the path is given relative) as a subdirectory of the current directory.
4. Remove Directory
The command
rmdir your_dir
removes directory your_dir if it is empty. If you want to remove not empty directory, see.
# Access Permission of File
Example
$ ls -l nparal.f
-rw-r--r-- 1 vogel user 776 Aug 30 1995 nparal.f
The first column is empty for data and programs or in first column is written character d if the item is directory etc. The next three columns are permissions for the user, the columns 5, 6, 7 for the user's group (in this example the group is called user), and the last three for the rest of the word. The next information in the row is the size of the file (in bytes), the date of the last update, and the name of the file. The next table clarifies the meaning of the letters written from the 2nd to the 10th column:
Character Meaning
r Permission for reading
w Permission for writing
x File is executable
If we want to allow people from the user's group to read this file and the rest of the word will be unable even to read this file, we will write the command:
$ chmod 760 nparal.f
The access permission looks now like:
$ ls -l nparal.f
-rwxrw---- 1 vogel user 776 Aug 30 1995 nparal.
To understand this you must know that number 1 "allows" and number 0 "suppresses" access permission and you need to know relation between octal and binary numbers:
Octal scale Binary scale
0 000
1 001
2 010
3 011
4 100
5 101
6 110
6 110
7 111
# Some Postfixes of Files
# Postfix
Meaning
.c Source program in C language
.f Source program in Fortran 77
.f90 Source program in Fortran 90
.p Source program in Pascal
.pbm bi-level, black and white image (2 bits per pixel)
.pgm grayscale (8 bits per pixel)
.ppm color (24 bits per pixel)
.jpg compressed by JPEG
# Determine File Type
The type of file can be detected by a command file.
Example:
$ file kvsortrec.f90
kvsortrec.f90: fortran program text
Return to Contents
# Structure of Standard Directories in Unix/Linux
Directory Meaning
/bin Directory for system command
/dev Directory with special files which enable to work with pheripheral devices
/etc System programs and data
/home User's home directories
/lib Libraries
/mnt Directory for mounting of disk pack
/tmp Directory for temporary data sets
/usr Other system programs
/var Files which are being updated during system running
# Other Information
1. Wildcards * and ?
* represents any sequence of symbols (0 or more), e.q.
h* represents how hop htrupp.c high help etc.
? represents any symbol; e.q.
IMPJET2?.DAT represents IMPJET21.DAT IMPJET24.DAT IMJET27.DAT etc.
2. Input and Output Redirection
The command
p <> my_out_file
causes input to the executable program p from my_in_file and output from the program p to the my_out_file. It is written from the beginning of this file.
The command
p <>> my_out_file
has the same meaning but the output is appended to the contents of my_out_file
No comments:
Post a Comment