One Day One Cmd

Place for playing with commands…

Monthly Archives: January 2011

Day 49: $ Arrange commands as subsequent.

ODOC: bala@bala:~ /home$ du && python sample.py && pwd
Use && to arrange for subsequent commands to run, only if earlier
ones succeeded. We can use it for some conditions.

In above command if python file shows any error means pwd command
will not execute.

Thats it…

 

Advertisements

Day 47: $ Convertor

ODOC: bala@bala:~ /home$ ffmpeg -i audio.wav -acodec libmp3lame audio.mp3
It is used to convert wav to mp3 format. for that we have to install ffmpeg by

For Debian based OS:

$sudo apg-get install ffmpeg

 

Day 48: $ Executing Commands in One line.

ODOC: bala@bala:~ /home$ du; python sample.py; pwd
We can write multiple commands on one line by separating them with ‘;’  it is
useful when the first command might takes a long time.

Day 46: $ tar

ODOC: bala@bala:~ /home$ tar tf xyz.tar
The GNU version of the tar archiving utility. We can list all files within an archieve.

$ tar xvf xyz.tar
This command is used to extract the tar and stores in the current directory.

Day 45: Mic Testing 1 2 3…

We can test mic with the followin command.

$ arecord -d 10 /tmp/test-mic.wav

It records for 10 sec. Now it is also easy to play your wave
file with simple alsa utility.

$ aplay /tmp/test-mic.wav

Day 44: $ seq

ODOC: bala@bala:~ /home$ seq
This command will prints the sequence of numbers. Also we can increment the
values by specific numbers. We can give start position and end position for
specific range.

Ex:
$ seq 5
1
2
3
4
5

$ seq 1 2 10
1
3
5
7
9

$ seq 5 10
5
6
7
8
9
10

Day 43: $ apropos

ODOC: bala@bala:~ /home$ apropos
search the manual page names and descriptions. This command searches a keyword in a command description text.
Therefore it is easy to find out what commands are related to keywords when using that as a keyword

Ex: $ apropos partition
addpart (8) – simple wrapper around the "add partition" ioctl
all-swaps (7) – event signalling that all swap partitions have been ac…
cfdisk (8) – Curses/slang based disk partition table manipulator fo…
delpart (8) – simple wrapper around the "del partition" ioctl
fdisk (8) – Partition table manipulator for Linux
mpartition (1) – partition an MSDOS hard disk
partprobe (8) – inform the OS of partition table changes
partx (8) – telling the kernel about presence and numbering of on-…
sfdisk (8) – Partition table manipulator for Linux

This command searches a keyword in a command description text.
Therefore it is easy to find out what commands are related to
partitions when using partition as a keyword:

Day 42: $ alias

ODOC: bala@bala:~ /home$ alias sl=ls
create names or abbreviations for commands. Alias can be used to correct our typos on
shell command line. For example we can create sl command to simulate ls command:

Ex:
$ alias sl=ls

NOTE: to unalias your commands use unalias command.
$ unalias ls

However, creation of aliases with alias command is temporary just for current terminal session.

Day 41: $ !s

ODOC: bala@bala:~ /home$ !c
This command executes lastly used command starting with ‘c’. Syntax is
Exclamatory symbol followed by alphabets. If you want to execute the command
starting with the character ‘s’ means you can use $ !s.

Ex.

/home$ !c
cd /home/Desktop

Day 40: $ ps -axu

ODOC: bala@bala:~ /home$ ps -axu
ps command is used to report a snapshot of the current processes. ps -axu
is used to see every process on the system using BSD syntax. For more info
see the man page of ps command.

Ex.
$ ps -axu