Wednesday, September 16, 2020
Can we create file in another directory ? UNIX - Privilege
Tuesday, August 25, 2020
UNIX COMMAND & SECURITY SYSTEM PART - 4
Security system in Multi user system
First we talk about the security system of file.
Security system of file means no other user are otherwise to access the file of another user.
Let we understand command:
Command : $ ls -l
Here :
ls - same as dir command in dos
-l - for log listing of file.
Output of Command [ $ ls -l ]
_rwxr_xr_x 3 amit staff 411 datetime a1
drwxr_xr_x 2 amit staff 411 datetime a2
--------- ---- --------- ---------
DETAILS:
MODE OF FILE Such as:
_rwxr_xr_x
drwxr_xr_x
NUMBER OF LINK Such as:
3
2
OWNER Such as:
amit
amit
GROUP Such as:
staff
staff
SIZE OF FILE Such as:
411
411
COMMAND Such as:
datetime
datetime
FILE NAME Such as:
a1
a1
NOTE:
_rwxr_xr_x 3 amit staff 411 datetime a1
drwxr_xr_x 2 amit staff 411 datetime a2
Here: _ Means ordinary files
d Means directory
b Means block read file (Such as: HDD , CDROM , Secondary Device)
c Means character read file (Such as: modem , printer etc). These files are also called device driver files. They are available in dev directory.
Suppose:
Form above it is clear that the numerical value of maximum number of permission is not more than ( 0 + 4 + 2 + 1 ) =7 for any owner , group and others of a file.
Detail information is given in the figure given below 👇
If we have any file than we can do following things such as :
Note: Maximum Possible Permissions are : 7 7 7
Example:
NOTE ABOUT GROUP:
Suppose we have three groups:
STAFF ACCOUNTS STORE ← Group name
amit amit raj
ajay anil raja
raja sumit ajay
- - -
- - -
Only administrator can create a group.
Only administrator can create user / login and associate to some group.
Friday, August 21, 2020
UNIX SHELL COMMAND & PIPELINING PART 3
|
Example : $ pg +2 ab1 here , +2 for display next two pages -3 for display previous three pages q for quit |
|
|
|
|
|
|
|
Detail : Search amit in current directory Example : $ grep " Shailu" ab* : $ grep -in amit ab2 Detail : where -in -optional [ignore] , amit - string , ab2 - filename |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This command is used for forcefully termination. |
Friday, July 31, 2020
UNIX SHELL COMMAND - PART 2
Command 1: $ data |
Command display date / time (only admin can change this time / date) |
Command 2: $ cal month year |
Note: Month will be (1 - 12) | Year will be (1 - 9999) Example: $ cal 1998 Display calendar of 1998 $ cal 9 2005 Display calendar of September 2005 $ cal 1752 Basic Year / Starting Year $ cal 9 1752 Basic Year / Starting Year |
Command 3: $ cat > filename |
Used to create a new file Example: $ cat > a1 File is created named a1. |
Command 4: $ cat filename |
Display content of file Example: $ cat a1 Display content of file a1 |
Command 5: $ sort -r filename |
Used for sorting , -r show reverse order sorting Example: $ sort -r a1 (sort by Z to A) Descending order $ sort a1 (sort by A to Z) Ascending order |
Command 6: $ sort a1 > a1 |
Output of a1 redirect to a1 file |
Command 7: $ cat a1 |
Display content of a1 file |
Command 8: $ cat a1 a2 |
Display content of a1 file & a2 file |
| |
Used to copy a1 file to a2 file i.e. (a1=a2) |
Command 10: $ cat a1 a2 > a3 |
Used to copy a1 and a2 into a3 file i.e (a3 = a1 + a2) |
Command 11: $ cat a1 , a2 >> a3 |
Used to append content of a3 file i.e (a3 = a1 + a2 + a3) Example: $ cat a2 , a1 >> a3 $ cat a1 , a2 >> a2 $ cat a1 >> a2 |
Command 12: $ man command name |
Used to show online help Example: $ man who |
Command 13: $ mkdir |
Used for creating new directory. |
Command 14: $ cd directory name |
Used for changing directory. Example: $ cd T3 $ cd . / T3 $ cd / user / jay / T3 $ cd . . / . . / user / jay / T3 $ cd . / jay / T3 $ cd . . / user / jay / T3 $ cd . . /. . /. . / user / jay / T3 $ cd . / . . / jay / T3 Note : All above commands are same regarding changing directory. |
Command 15: $ cp Source file Target file |
Used for copy any file from source directory to destination directory. Example: $ cp / user / jay / T1 / user / jay / T3 / m [OR] $ cp . . / T1 . / m |
Command 16: $ mv Source file Target file |
Used for move or rename file source to target. Example: $ mv / user / jay / T1 / user / jay / T3 / m [OR] $ mv . . / T1 . / T3 / m |
| |
Used for removing directory. Example: $ rmdir T3 |
Command 17: $ rm file(s) |
Used for removing files. Example: $ rm m (It will remove m from jay directory by searching) Note : $ rm * ( For matching with all ) $ rm * . * ( For removing all files ) |
| |
ab* means file name start with ab and end with any. -i If we write -i than it will ask (are you sure [Y , N]) |
Command 20: $ wc -lwc File Name |
Used for forward counting l - Line w - Word c - Char Example: $ wc -lwc ab1 Output like : 5 6 52 ( line=5, word=6, char=52) $ wc -l ab1 Output like : 5 ( line=5) $ wc -wl ab1 Output like : 6 5 ( word=6, line=5) |