Septanet Forum  

Go Back   Septanet Forum > Computers, Software, Harware, Information Technology > Operating systems > Linux

Reply
 
LinkBack Thread Tools Display Modes
Old 26-08-2011, 11:48 AM   #1
Senior Member
 
harry's Avatar
 
Join Date: Aug 2011
Posts: 103
Default Some basic command in linux

1.mv file1 file2 – rename or move file1 to file2

2.tail file – output the last 10 lines of file.

3.whoami – who you are logged in as.

4.df-show disk usage.

5.chmod octal file – change the permissions of file
to octal, which can be found separately for user,
group, and world by adding:
● 4 – read (r)
● 2 – write (w)
● 1 – execute (x)

YOU CAN USE ABOVE SOME BASIC COMMANDS UNDER LINUX OPERATION SYSTEM.
harry is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 26-08-2011, 12:36 PM   #2
Senior Member
 
sachin's Avatar
 
Join Date: Aug 2011
Posts: 131
Thumbs up

Excellent Job Harry

Something is from my side too

In binary number we useually write in following way
32 16 8 4 2 1
means 2 raise to power 5 is 32
2 raise to power 4 is 16
2 raise to power 3 is 8
2 raise to power 2 is 4
2 raise to power 1 is 2
2 raise to power 0 is 1
but the condition is on every place there must be binary 1
if there will be binary 0 then the resultant will be zero

Now for permissions,
first digit represents read
second digit represents write and
third digit represents execute
so if we only want to give rights of read then it must be
100=(2 raise to power 2)+(0 raise to power 1)+(0 raise to power 0)=4

If we want to give read+write then it will be
110=(2 raise to power 2)+(2 raise to power 1)+(0 raise to power 0)=6

If we want to give read+write+execute then it will be
111=(2 raise to power 2)+(2 raise to power 1)+(2 raise to power 0)=7

In three digit permission number, first denotes to owner, second denotes to group and third one denotes to others

So if we want to give read+write+execute rights to owner,
read+write rights to group and
read rights to others,
then it would be
764

and read+write+execute rights to everybody then
it will be 777

Enjoy coding
sachin is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 26-08-2011, 01:22 PM   #3
Senior Member
 
sharma.s.prakash's Avatar
 
Join Date: Aug 2011
Posts: 110
Smile

Good one
solving two purpose one is for rights and other one is to convert from binary to Decimal number
sharma.s.prakash is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 29-08-2011, 10:35 AM   #4
Senior Member
 
kaman's Avatar
 
Join Date: Aug 2011
Posts: 110
Default

Quote:
Originally Posted by sachin View Post
Excellent Job Harry

Something is from my side too

In binary number we useually write in following way
32 16 8 4 2 1
means 2 raise to power 5 is 32
2 raise to power 4 is 16
2 raise to power 3 is 8
2 raise to power 2 is 4
2 raise to power 1 is 2
2 raise to power 0 is 1
but the condition is on every place there must be binary 1
if there will be binary 0 then the resultant will be zero

Now for permissions,
first digit represents read
second digit represents write and
third digit represents execute
so if we only want to give rights of read then it must be
100=(2 raise to power 2)+(0 raise to power 1)+(0 raise to power 0)=4

If we want to give read+write then it will be
110=(2 raise to power 2)+(2 raise to power 1)+(0 raise to power 0)=6

If we want to give read+write+execute then it will be
111=(2 raise to power 2)+(2 raise to power 1)+(2 raise to power 0)=7

In three digit permission number, first denotes to owner, second denotes to group and third one denotes to others

So if we want to give read+write+execute rights to owner,
read+write rights to group and
read rights to others,
then it would be
764

and read+write+execute rights to everybody then
it will be 777

Enjoy coding
Awesome!!! Very informative and throughly explained.
kaman is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 29-08-2011, 02:28 PM   #5
Senior Member
 
harry's Avatar
 
Join Date: Aug 2011
Posts: 103
Default

Thanks for another addons
harry is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 01-09-2011, 05:19 PM   #6
Junior Member
 
Join Date: Sep 2011
Posts: 1
Default

I am just adding to your data base of knowledge

Suppose you want to know which file was last edited out of hundreds files then use below command

ls -ltrh

The last modified file will be at bottom show , enjoy the result

Thanks
Rajesh is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 01-09-2011, 05:21 PM   #7
Senior Member
 
sachin's Avatar
 
Join Date: Aug 2011
Posts: 131
Thumbs up

hmmmmmmmmmm informative

Welcome Rajesh
sachin is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 01-09-2011, 05:46 PM   #8
Senior Member
 
kaman's Avatar
 
Join Date: Aug 2011
Posts: 110
Default

Quote:
Originally Posted by Rajesh View Post
I am just adding to your data base of knowledge

Suppose you want to know which file was last edited out of hundreds files then use below command

ls -ltrh

The last modified file will be at bottom show , enjoy the result

Thanks
Thanks, Rajesh!
Welcome to Forum. Keep posting.
kaman is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 01-09-2011, 06:24 PM   #9
Junior Member
 
Join Date: Aug 2011
Posts: 1
Smile

Permission Groups are

u - Owner - owns the file
g - Group - a member of the group that owns the file
o - Other - neither the owner, nor belonging to the group that owns the file
a - All Users

Permission Types are

read
write
execute

Read permission

Folder - one can check the content of a folder (ls command) but can not change directory (cd command)
File - one can only able to read the file (cat command)

Read and Write permission

Folder - one can only do the same as mention above in read permission
File - one can modify the content of file

Read and Execute permission

Folder - one can change the directory (cd command) but can not able to create folder (mkdir command) or file (touch command) under it.
File - file became executable

ALL permission

Folder - one can check the content, change directory and create file & folder.
File - one can read, modify and execute


ls -l commond will display permissions of file and folder, something like the following

-rwxr-xr-x

- flag (start from left side) used for regular file and d flag used for directory. Next 3 flag is used to show the permission of owner. Next 3 flag for group permission and remaing 3 flag indicating the permission for other.

To set/modify a file's permissions we need to use the chmod command and chmod command will be used to set permissions in either of two modes:

Absolute Mode – Use numbers to add permissions or remove permissions. Absolute mode is the method most commonly used to set permissions.
Symbolic Mode – Use combinations of letters and symbols to add permissions or remove permissions.

Abolute mode is already explain by harry and sachin. so I am only describing symbolic mode through some example

Add execute permissions for owner
chmod u+x sandy

Remove the execute permission from both the file's owner and group
chmod ug-x sandy

remove all the permissions but add read permission for everybody
chmod a=r sandy
sandeepgurung7 is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 02-09-2011, 10:21 AM   #10
Senior Member
 
kaman's Avatar
 
Join Date: Aug 2011
Posts: 110
Thumbs up

Very informative article, Sandy sir. Thanks for sharing.
kaman is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 01:29 AM.


Content Relevant URLs by vBSEO 3.5.0 RC2