One Day One Cmd

Place for playing with commands…

Invitation to connect on LinkedIn

LinkedIn
From Balakrishnan Vijayabaskar

Project Engineer at Wipro
Chennai Area, India

I’d like to add you to my professional network on LinkedIn.

– Balakrishnan

Confirm that you know Balakrishnan
You are receiving Invitation to Connect emails. Unsubscribe
© 2013, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA

14k32x-hozqe2tv-12.gif

Day 100:$ ip addr show

ODOC:About ip addr show command
This command is used to display the ip address details

Example

praveen@praveen-desktop:~$ ip addr show

this command displays like this

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:e0:4c:15:ef:27 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::2e0:4cff:fe15:ef27/64 scope link 
       valid_lft forever preferred_lft forever

With Regards,
S. Praveen

Day 99:$gpg filename.gpg command (Decrypt)

ODOC:About gpg filename.gpg command

This command is used to Encrypt a file.

Example
Yesterday We learn about encrypt file in my desktop names “aaa.gpg”

Now i wish to decrypt a file

So goto desktop first,
Then type pgp aaa.gpg (filename.gpg)

praveen@praveen-desktop:~/Desktop$ gpg aaa.gpg
Enter passpharse: _
Repeat passpharse: _

please type passpharse that yesterday typed for encrypting.

After putting passpharse, it show’s like this

praveen@praveen-desktop:~/Desktop$ _

That’s all you are successfully Decrypt a file.
Now you can see encrypted file names “aaa” in your desktop

With Regards,
S. Praveen

Day 98:$gpg -c command

ODOC:About gpg -c command

This command is used to Encrypt a file.

Example

I am creating a file names “aaa” in my desktop.
Then I am going to my desktop using cd command.
Then,

praveen@praveen-desktop:~/Desktop$ gpg -c aaa
Enter passpharse: _
Repeat passpharse: _

Now it ask passpharse for the file, Then ask retype passpharse.
After putting passpharse, it show’s like this

praveen@praveen-desktop:~/Desktop$ _

That’s all you are successfully created a Encrypted file.
Now you can see encrypted file names “aaa.gpg” in your desktop

With Regards,
S. Praveen

Day 97: $ fdisk -v

ODOC:About fdisk -v command

Print version number of fdisk program and exit.

Example

praveen@praveen-desktop:~$ sudo fdisk -v
[sudo] password for praveen: _

It will display like this…

fdisk (util-linux-ng 2.17.2)

With Regards,
S. Praveen

Day 96: $ fdisk -l

ODOC: About fdisk -l command

List the partition tables for the specified devices and then exit. If no devices are given, those mentioned in /proc/partitions (if that exists) are used.

Syntaxfdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

Example

praveen@praveen-desktop:~$ sudo fdisk -l
[sudo] password for praveen: _

It will display like this

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000307ca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         244     1951744   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2             245        9730    76189671+   5  Extended
/dev/sda5            3891        9730    46899200   83  Linux
/dev/sda6             245        3890    29286463+  83  Linux

With Regards,
S. Praveen

Day 95: $ps -ef Command

ODOC: About ps-ef command

Display full information about each of the processes currently running.

Example

praveen@praveen:~$ ps -ef

This cmd will display details like tis

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 08:16 ?        00:00:00 /sbin/init
root         2     0  0 08:16 ?        00:00:00 [kthreadd]
root         3     2  0 08:16 ?        00:00:00 [ksoftirqd/0]
root         4     2  0 08:16 ?        00:00:00 [migration/0]
root         5     2  0 08:16 ?        00:00:00 [watchdog/0]
root         6     2  0 08:16 ?        00:00:00 [events/0]
root         7     2  0 08:16 ?        00:00:00 [cpuset]
root         8     2  0 08:16 ?        00:00:00 [khelper]
root         9     2  0 08:16 ?        00:00:00 [netns]
root        10     2  0 08:16 ?        00:00:00 [async/mgr]
root        11     2  0 08:16 ?        00:00:00 [pm]
root        12     2  0 08:16 ?        00:00:00 [sync_supers]
root        13     2  0 08:16 ?        00:00:00 [bdi-default]
root        14     2  0 08:16 ?        00:00:00 [kintegrityd/0]
root        15     2  0 08:16 ?        00:00:00 [kblockd/0]
root        16     2  0 08:16 ?        00:00:00 [kacpid]
root        17     2  0 08:16 ?        00:00:00 [kacpi_notify]
root        18     2  0 08:16 ?        00:00:00 [kacpi_hotplug]
root        19     2  0 08:16 ?        00:00:00 [ata_aux]
root        20     2  0 08:16 ?        00:00:00 [ata_sff/0]
root        21     2  0 08:16 ?        00:00:00 [khubd]
root        22     2  0 08:16 ?        00:00:00 [kseriod]
root        23     2  0 08:16 ?        00:00:00 [kmmcd]
root        25     2  0 08:16 ?        00:00:00 [khungtaskd]
root        26     2  0 08:16 ?        00:00:00 [kswapd0]
root        27     2  0 08:16 ?        00:00:00 [ksmd]
root        28     2  0 08:16 ?        00:00:00 [aio/0]
root        29     2  0 08:16 ?        00:00:00 [ecryptfs-kthrea]
root        30     2  0 08:16 ?        00:00:00 [crypto/0]
root        36     2  0 08:16 ?        00:00:00 [scsi_eh_0]
root        37     2  0 08:16 ?        00:00:00 [scsi_eh_1]
root        40     2  0 08:16 ?        00:00:00 [kstriped]
root        41     2  0 08:16 ?        00:00:00 [kmpathd/0]
root        42     2  0 08:16 ?        00:00:00 [kmpath_handlerd]
root        43     2  0 08:16 ?        00:00:00 [ksnapd]
root        44     2  0 08:16 ?        00:00:00 [kondemand/0]
root        45     2  0 08:16 ?        00:00:00 [kconservative/0]
root       210     2  0 08:16 ?        00:00:00 [usbhid_resumer]
root       236     2  0 08:16 ?        00:00:00 [flush-8:0]
root       237     2  0 08:16 ?        00:00:00 [jbd2/sda7-8]
root       238     2  0 08:16 ?        00:00:00 [ext4-dio-unwrit]
root       282     1  0 08:17 ?        00:00:00 upstart-udev-bridge --daemon
root       285     1  0 08:17 ?        00:00:00 udevd --daemon
root       606   285  0 08:17 ?        00:00:00 udevd --daemon
root       661   285  0 08:17 ?        00:00:00 udevd --daemon
syslog     967     1  0 08:17 ?        00:00:00 rsyslogd -c4
102       1001     1  0 08:17 ?        00:00:00 dbus-daemon --system --fork
root      1022     2  0 08:17 ?        00:00:00 [i915]
root      1027     1  0 08:17 ?        00:00:00 NetworkManager
avahi     1033     1  0 08:17 ?        00:00:00 avahi-daemon: running [praveen.l
avahi     1040  1033  0 08:17 ?        00:00:00 avahi-daemon: chroot helper
root      1044     1  0 08:17 ?        00:00:00 /usr/sbin/modem-manager
root      1061     1  0 08:17 ?        00:00:00 /sbin/wpa_supplicant -u -s
root      1062  1027  0 08:17 ?        00:00:00 /sbin/dhclient -d -sf /usr/lib/N
root      1126     1  0 08:17 tty4     00:00:00 /sbin/getty -8 38400 tty4
root      1128     2  0 08:17 ?        00:00:00 [kslowd000]
root      1131     2  0 08:17 ?        00:00:00 [kslowd001]
root      1145     1  0 08:17 tty5     00:00:00 /sbin/getty -8 38400 tty5
root      1162     1  0 08:17 tty2     00:00:00 /sbin/getty -8 38400 tty2
root      1164     1  0 08:17 tty3     00:00:00 /sbin/getty -8 38400 tty3
root      1171     1  0 08:17 tty6     00:00:00 /sbin/getty -8 38400 tty6
root      1174     1  0 08:17 ?        00:00:00 acpid -c /etc/acpi/events -s /va
root      1179     1  0 08:17 ?        00:00:00 anacron -s
root      1182     1  0 08:17 ?        00:00:00 cron
daemon    1183     1  0 08:17 ?        00:00:00 atd
root      1189     1  0 08:17 ?        00:00:00 gdm-binary
root      1220     1  0 08:17 ?        00:00:00 /usr/sbin/console-kit-daemon --n
root      1322  1189  0 08:17 ?        00:00:00 /usr/lib/gdm/gdm-simple-slave --
mysql     1330     1  0 08:17 ?        00:00:00 /usr/sbin/mysqld
root      1358     1  0 08:17 ?        00:00:00 /usr/sbin/cupsd -C /etc/cups/cup
root      1390     1  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1395  1390  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1396  1390  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1397  1390  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1398  1390  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  1399  1390  0 08:17 ?        00:00:00 /usr/sbin/apache2 -k start
root      1442  1322  3 08:17 tty7     00:00:18 /usr/bin/X :0 -nr -verbose -auth
root      1483  1322  0 08:17 ?        00:00:00 /usr/lib/gdm/gdm-session-worker
praveen   1547  1483  0 08:17 ?        00:00:00 gnome-session
praveen   1580  1547  0 08:17 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus
praveen   1583     1  0 08:17 ?        00:00:00 /usr/bin/dbus-launch --exit-with
praveen   1584     1  0 08:17 ?        00:00:00 /bin/dbus-daemon --fork --print-
praveen   1600     1  0 08:17 ?        00:00:00 /usr/lib/libgconf2-4/gconfd-2
root      1652     1  0 08:17 tty1     00:00:00 /sbin/getty -8 38400 tty1
praveen   1653  1547  0 08:17 ?        00:00:00 gnome-power-manager
praveen   1659     1  0 08:17 ?        00:00:00 /usr/bin/gnome-keyring-daemon --
praveen   1663     1  0 08:17 ?        00:00:00 /usr/lib/gnome-settings-daemon/g
root      1667     1  0 08:17 ?        00:00:00 /usr/lib/upower/upowerd
praveen   1688     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfsd
root      1693     1  0 08:17 ?        00:00:00 /usr/lib/policykit-1/polkitd
praveen   1708     1  0 08:17 ?        00:00:00 /usr/lib/gvfs//gvfs-fuse-daemon
praveen   1719  1547  0 08:17 ?        00:00:00 nm-applet --sm-disable
praveen   1723  1547  0 08:17 ?        00:00:00 /usr/bin/python /usr/bin/blueman
praveen   1730  1547  0 08:17 ?        00:00:01 metacity --replace
praveen   1731  1547  0 08:17 ?        00:00:00 /usr/lib/evolution/2.30/evolutio
praveen   1734  1547  0 08:17 ?        00:00:00 bluetooth-applet
praveen   1736  1547  0 08:17 ?        00:00:01 nautilus
praveen   1738  1547  0 08:17 ?        00:00:01 gnome-panel
praveen   1740     1  0 08:17 ?        00:00:00 /usr/bin/pulseaudio --start --lo
praveen   1741  1547  0 08:17 ?        00:00:00 /usr/lib/policykit-1-gnome/polki
rtkit     1746     1  0 08:17 ?        00:00:00 /usr/lib/rtkit/rtkit-daemon
praveen   1775  1740  0 08:17 ?        00:00:00 /usr/lib/pulseaudio/pulse/gconf-
praveen   1783     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfsd-trash --spaw
praveen   1787     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfs-gdu-volume-mo
root      1796     1  0 08:17 ?        00:00:00 /usr/lib/udisks/udisks-daemon
praveen   1802     1  0 08:17 ?        00:00:00 /usr/lib/bonobo-activation/bonob
root      1803  1796  0 08:17 ?        00:00:00 udisks-daemon: polling /dev/sr0
praveen   1816     1  0 08:17 ?        00:00:02 /usr/lib/gnome-panel/wnck-applet
praveen   1817     1  0 08:17 ?        00:00:00 /usr/lib/gnome-applets/trashappl
praveen   1823     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfs-afc-volume-mo
praveen   1826     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volum
praveen   1831     1  0 08:17 ?        00:00:00 /usr/bin/obex-data-server --no-d
praveen   1838     1  0 08:17 ?        00:00:00 /usr/lib/gnome-panel/clock-apple
praveen   1839     1  0 08:17 ?        00:00:00 /usr/lib/gnome-panel/notificatio
praveen   1841     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfsd-burn --spawn
praveen   1853     1  0 08:17 ?        00:00:00 /usr/lib/gvfs/gvfsd-metadata
praveen   1859     1  0 08:17 ?        00:00:00 gnome-screensaver
praveen   1865  1547  0 08:17 ?        00:00:00 /usr/lib/gnome-disk-utility/gdu-
praveen   1867     1  7 08:17 ?        00:00:33 /usr/lib/chromium-browser/chromi
praveen   1869  1867  0 08:17 ?        00:00:00 /usr/lib/chromium-browser/chromi
praveen   1872     1  0 08:17 ?        00:00:00 /usr/lib/chromium-browser/chromi
praveen   1899  1872  0 08:17 ?        00:00:00 /usr/lib/chromium-browser/chromi
praveen   1922  1872  0 08:17 ?        00:00:00 /usr/lib/chromium-browser/chromi
praveen   1952  1547  0 08:17 ?        00:00:00 /usr/bin/python /usr/share/syste
praveen   1954  1872  0 08:17 ?        00:00:02 /usr/lib/chromium-browser/chromi
praveen   1963  1867  2 08:17 ?        00:00:11 /usr/lib/chromium-browser/chromi
praveen   1965  1547  0 08:18 ?        00:00:00 update-notifier
root      1975     1  0 08:18 ?        00:00:00 /usr/bin/python /usr/lib/system-
praveen   2032  1872  2 08:18 ?        00:00:11 /usr/lib/chromium-browser/chromi
root      2053  1179  0 08:22 ?        00:00:00 /bin/sh -c nice run-parts --repo
root      2055  2053  0 08:22 ?        00:00:00 run-parts --report /etc/cron.dai
root      2061  2055  0 08:22 ?        00:00:00 /bin/sh /etc/cron.daily/apt
root      2096  2061  0 08:22 ?        00:00:00 sleep 867
praveen   2142  1872  3 08:22 ?        00:00:05 /usr/lib/chromium-browser/chromi
praveen   2150     1  0 08:23 ?        00:00:00 gedit /home/praveen/Desktop/prav
praveen   2155     1  0 08:24 ?        00:00:00 gnome-terminal
praveen   2158  2155  0 08:24 ?        00:00:00 gnome-pty-helper
praveen   2159  2155  0 08:24 pts/0    00:00:00 bash
praveen   2189  2159  0 08:25 pts/0    00:00:00 ps -ef

With Regards,
S. Praveen

Day 94: $ps Command

ODOC: About ps command
Reports the process status.

Syntax

-a -> List information about all processes most frequently requested: all those except process group leaders and processes not associated with a terminal.

-A -> List information for all processes. Identical to -e, below.

-c -> Print information in a format that reflects scheduler properties as described in priocntl.
The -c option affects the output of the -f and -l options, as described below.

-d -> List information about all processes except session leaders.

-e -> List information about every process now running.

-f -> Generate a full listing.

-j -> Print session ID and process group ID.

-l -> Generate a long listing.

-L -> Print information about each light weight process (lwp) in each selected process.

-P -> Print the number of the processor to which the process or lwp is bound, if any, under an additional column header, PSR.

-y -> Under a long listing (-l), omit the obsolete F and ADDR columns and include an RSS column to report the resident set size of the process. Under the -y option, both RSS and SZ will be reported in units of kilobytes instead of pages.

-g grplist -> List only process data whose group leader’s ID number(s) appears in grplist. (A group leader is a process whose process ID number is identical to its process group ID number.)

-n namelist -> Specify the name of an alternative system namelist file in place of the default. This option is accepted for compatibility, but is ignored.

-o format -> Print information according to the format specification given in format. This is fully described in DISPLAY FORMATS. Multiple -o options can be specified; the format specification will be interpreted as the space-character-separated concatenation of all the format option-arguments.

-p proclist -> List only process data whose process ID numbers are given in proclist.

-s sidlist -> List information on all session leaders whose IDs appear in sidlist.

-t term -> List only process data associated with term. Terminal identifiers are specified as a device file name, and an identifier. For example, term/a, or pts/0.

-u uidlist -> List only process data whose effective user ID number or login name is given in uidlist. In the listing, the numerical user ID will be printed unless you give the -f option, which prints the login name.

-U uidlist -> List information for processes whose real user ID numbers or login names are given in uidlist. The uidlist must be a single argument in the form of a blank- or comma-separated list.

-G gidlist -> List information for processes whose real group ID numbers are given in gidlist. The gidlist must be a single argument in the form of a blank- or comma-separated list.

Examples

praveen@praveen:~$ ps
PID   TTY   TIME   CMD
6874  pts/9   0:00     ksh
6877  pts/9   0:01     csh
418   pts/9   0:00     csh

With Regards,
S. Praveen

Day 93: $chsh command

ODOC: About chsh command
Enables a user to change their login shell.

Syntax

chsh [-s login_shell] [user]

-s -> login_shell Enables a user to specify the login shell.

Examples

chsh

Used without the -s option enables the user to specify the path of their shell.

VALID SHELLS

chsh will accept the full pathname of any executable file on the system. However, it will issue a warning if the shell is not listed in the /etc/shells file. On the other hand, it can also be configured such that it will only accept shells listed in this file, unless you are root.

With Regards,
S. Praveen

Day 92: $stty command

ODOC: About stty command
Sets options for your terminal.

Examples:

stty
typing stty alone on a dialup connection would list the information about the connection. Below is an example of what may be displayed.

praveen@praveen:~$ stty
speed 38400 baud; -parity
rows = 49; columns = 132; ypixels = 0; xpixels = 0;
erase = ^h; swtch = ;
brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3
echo echoe echok echoctl echoke iexten 

With Regards,
S. Praveen