You will always find yourself in troubling in linux .
I am trying to practice & introduce a few commands that will be useful. .
——————————————————————————————————-
1 . How to view your active interfaces :
The ifconfig command without any arguments gives you all the active interfaces on your system.
Usage :
roshan@roshan-Presario-B2800-EN662PA-ACJ:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:35:36:96:f8
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Base address:0xd800
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:720 (720.0 B) TX bytes:720 (720.0 B)
ppp0 Link encap:Point-to-Point Protocol
inet addr:115.242.21.126 P-t-P:220.224.141.129 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:4799 errors:71 dropped:0 overruns:0 frame:0
TX packets:5445 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:3752018 (3.7 MB) TX bytes:699101 (699.1 KB)
——————————————————————————————————————-
2 .
last, lastb – show listing of last logged in users
SYNOPSIS
last [-R] [-num] [ -n num ] [-adFiox] [ -f file ] [ -t YYYYMMDDHHMMSS ] [name...] [tty...]
lastb [-R] [-num] [ -n num ] [ -f file ] [-adFiox] [name...] [tty...]
DESCRIPTION
Last searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of
all users logged in (and out) since that file was created. Names of users and tty’s can be given, in which case
last will show only those entries matching the arguments. Names of ttys can be abbreviated, thus last 0 is the
same as last tty0.
Usage :
backtrack@backtrack-Presario-B2800-EN662PA-ACJ:~$ last
backtrac pts/0 :0.0 Wed Jan 25 18:00 still logged in
backtrac tty7 :0 Wed Jan 25 16:59 still logged in
reboot system boot 2.6.38-8-generic Wed Jan 25 16:59 – 18:07 (01:07)
backtrac pts/1 :0.0 Wed Jan 25 06:45 – 07:10 (00:24)
backtrac pts/0 :0.0 Wed Jan 25 06:37 – 06:54 (00:17)
backtrac tty7 :0 Wed Jan 25 06:33 – down (00:37)
reboot system boot 2.6.38-8-generic Wed Jan 25 06:32 – 07:10 (00:37)
backtrac tty7 :0 Wed Jan 25 05:13 – crash (01:19)
————————————————————————————————————————-
3 . How to investigate Sockets ?
SYNOPSIS
ss [options] [ FILTER ]
DESCRIPTION
ss is used to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state informations than other tools.
Usage :
roshan@roshan-Presario-B2800-EN662PA-ACJ:~$ ss
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 115.242.67.114:44753 74.125.236.101:www
ESTAB 0 0 115.242.8.186:51767 208.117.238.38:www
ESTAB 0 0 115.242.67.114:39984 69.171.227.48:https
ESTAB 0 4799 115.242.38.74:41154 69.63.181.12:https
ESTAB 0 0 115.242.67.114:42734 69.171.224.40:https
ESTAB 0 4768 115.242.38.74:41155 69.63.181.12:https
ESTAB 0 0 115.242.67.114:56417 69.171.224.11:https
ESTAB 0 0 115.242.67.114:56434 69.171.224.11:https
—————————————————————————————————————————
4 . How to report VIRTUAL MEMORY STATISTICS ?
SYNOPSIS
vmstat [options]
DESCRIPTION
vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.
The first report produced gives averages since the last reboot. Additional reports give information on a sampling
period of length delay. The process and memory reports are instantaneous in either case.
Usage :
roshan@roshan-Presario-B2800-EN662PA-ACJ:~$ vmstat
procs ———–memory———— —swap– —–io—- -system– —-cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 28292 4724 89532 0 0 99 51 618 1305 27 5 66 2
————————————————————————————————————————
5 . To check and display Linux tasks
SYNOPSIS
top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
The traditional switches ‘-’ and whitespace are optional.
DESCRIPTION
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information displayed for tasks are all user configurable and that configu‐
ration can be made persistent across restarts.
backtrack@backtrack-Presario-B2800-EN662PA-ACJ:~$ top
