Linux Tips and Tricks

Linux Tips and Tricks

Calculate the execution time for a script or command

October20

You can use time to find out he execution time of any command or script

Example:

1
2
3
4
5
6
$ time ls
01 - Veera.Mp3 02 - Usure Pogudhey.Mp3 03 - Kodu Poatta.Mp3 04 - Kaattu Sirukki.Mp3 05 - Kalvare.Mp3 06 - Keda Kari.Mp3
 
real 0m0.004s
user 0m0.000s
sys 0m0.004s

In the above example the time taken by the ls command is 0.004s

posted under Uncategorized | No Comments »

Date command Tips in GNU

October20
1
2
$ date -d "last monday"
Mon Jun 28 00:00:00 IST 2010
1
2
$ date -d "last sunday"
Sun Jun 27 00:00:00 IST 2010
1
2
$ date -d "1 day ago"
Fri Jul 2 14:58:42 IST 2010
1
2
$ date -d "2 days"
Mon Jul 5 14:59:02 IST 2010
1
2
$ date -d "200 days"
Wed Jan 19 14:59:07 IST 2011
1
2
$ date -d "last saturday" +%d-%m-%Y
26-06-2010
1
2
$ date -d "1 hour ago"
Sat Jul 3 14:01:09 IST 2010
1
2
$ date
Sat Jul 3 15:01:11 IST 2010
posted under Uncategorized | No Comments »

Copy command for taking backup

October20

This is one of the trick in copy command

Normally we take backup the file using the following syntax

cp <file_name.sh> <file_name.sh.bak>

you can use do the samething like this also…

1
cp file_name.{sh,sh.bak}


posted under Uncategorized | No Comments »

apropos – what is that :)

October20

Apropos is the command which search the entire manual (man) page entries and its description.

what is the usage of this command ?
we can easily get the Linux commands using the search word.

example :
The below output is for the search word “network”

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$ apropos network
/etc/network/interfaces (5) [interfaces] - network interface configuration for ifup and ifdown
aseqnet (1) - ALSA sequencer connectors over network
avahi-autoipd (8) - IPv4LL network address configuration daemon
bittorrent-downloader.bittorrent (1) - download files using a scatter-gather network
btdownloadcurses (1) - download files using a scatter-gather network
btdownloadcurses.bittorrent (1) - download files using a scatter-gather network
btdownloadgui (1) - download files using a scatter-gather network
btdownloadgui.bittorrent (1) - download files using a scatter-gather network
btdownloadheadless (1) - download files using a scatter-gather network
btdownloadheadless.bittorrent (1) - download files using a scatter-gather network
ctstat (8) - unified linux network statistics
dhclient-script (8) - DHCP client network configuration script
display-tele (7) - Forwards the display over a network
ifconfig (8) - configure a network interface
ifdown (8) - take a network interface down
ifup (8) - bring a network interface up
interfaces (5) - network interface configuration for ifup and ifdown
iwconfig (8) - configure a wireless network interface
iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
iwpriv (8) - configure optionals (private) parameters of a wireless network interface
jng (5) - JPEG Network Graphics (JNG) sub-format
libmng (3) - Multiple-image Network Graphics (MNG) Reference Library 1.0.9
libpng (3) - Portable Network Graphics (PNG) Reference Library 1.2.27
lnstat (8) - unified linux network statistics
mng (5) - Multiple-image Network Graphics (MNG) format
mtr (8) - a network diagnostic tool
nameif (8) - name network interfaces based on MAC addresses
Net::Cmd (3perl) - Network Command class (as used by FTP, SMTP etc)
Net::Time (3perl) - time and daytime network client interface
netdevice (7) - Low level access to Linux network devices
netstat (8) - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
network-admin (1) - Network Administration Tool
NetworkManager (8) - network management daemon
networks (5) - network name information
nm-tool (1) - utility to report NetworkManager state
nm-vpn-properties (1) - Network management framework
nmap (1) - Network exploration tool and security / port scanner
nstat (8) - network statistics tools.
pabrowse (1) - List PulseAudio sound servers on the network
perlfaq9 (1) - Networking ($Revision: 8539 $)
ping (8) - send ICMP ECHO_REQUEST to network hosts
ping6 (8) - send ICMP ECHO_REQUEST to network hosts
png (5) - Portable Network Graphics (PNG) format
rtacct (8) - network statistics tools.
rtstat (8) - unified linux network statistics
sane-net (5) - SANE network backend
saned (8) - SANE network daemon
services (5) - Internet network services list
slattach (8) - attach a network interface to a serial line
smbtree (1) - A text based smb network browser
tcpdump (8) - dump traffic on a network
tracepath (8) - traces path to a network host discovering MTU along this path
tracepath6 (8) - traces path to a network host discovering MTU along this path
traceroute6 (8) - traces path to a network host
traceroute6.iputils (8) - traces path to a network host
wget (1) - The non-interactive network downloader.
posted under Uncategorized | No Comments »
Newer Entries »

Recent Comments

    Categories