One Day One Cmd

Place for playing with commands…

Monthly Archives: December 2010

Day33: $ paste

ODOC: bala@bala:~ /home$ paste file1 file2 > file3
paste command reads the data in specified files and stores i the new file. We can seperate the data using -d”!” instead of tab.

Eg: paste file1 file2 > file3
If the content of file1 is:
1
2
3
and file2 is:
a
b
c
d
the resulting file3 would be:
1 a
2 b
3 c
d

For more details use man paste

Advertisements

Day32: $ chmod Changing file or folder permissions.

ODOC: bala@bala:~ /home$ chmod 755 new.txt
The chmod command is used to change the permission of files and directories. Here new.txt got the read,write,execute permission to the user. Read and Execute permission to Group and Others.

Generally the first digit stands for ‘User’, second digit stands for ‘Group’, and third digit stands for ‘Others’. Now 7 will be classified into 4,2,1 (i.e) Read, Write, Execute.

For more details use man chmod

Day31: $ chown Changing owner permissions.

ODOC: bala@bala:~ /home$ chown guest new.txt
The chown command is used to change ownership of files and directories. Here new.txt is now owned by the user guest, Format chown newowner filename.
For more details use man chown

clear view:
$ ls -l
$ sudo  chown root new.txt
$ ls -l

You can see the difference…;)

Day30: $ cal calendar.

ODOC: bala@bala:~ /home$ cal
It will display a calendar of the current month, also we can display the specified month and year calendar for the desired month and year.

Ex. cal jan 2011

January 2011
Su Mo Tu We Th Fr  Sa
1
2     3    4     5     6     7   8
9    10   11  12   13  14   15
16  17   18  19   20  21  22
23  24  25   26  27   28 29
30  31

Day29: $ bc Calculator.

ODOC: bala@bala:~ /home$ bc
It is an arbitrary precision calculator, we can do arithmetic calculation in interactive mode. we can also use hexa decimal values A-F.

Ex. bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty’.
10+A
20

Day28: $ history

ODOC: Listing the commands used before.
bala@bala:~ /home$ history
This command is used to Display the list of commands used before. we can limit the list by giving the value next to it. For more details see man history.

Ex. history 5

1  ls
2  cd /dev/sda5
3  cd media
4  cd media
5  history 5