lspci -vmm . Dump PCI device data in a machine readable form for easy parsing by scripts

commandline session

$lspci -vmm
Slot:	00:00.0
Class:	RAM memory
Vendor:	NVIDIA Corporation
Device:	MCP61 Memory Controller
SVendor:	Giga-byte Technology
SDevice:	Device 5001
Rev:	a1

Slot:	00:01.0
Class:	ISA bridge
Vendor:	NVIDIA Corporation
Device:	MCP61 LPC Bridge
SVendor:	Giga-byte Technology
SDevice:	Device 0c11
Rev:	a2

Slot:	00:01.1
Class:	SMBus
Vendor:	NVIDIA Corporation
Device:	MCP61 SMBus
SVendor:	Giga-byte Technology
SDevice:	Device 0c11
Rev:	a2

Slot:	00:01.2
Class:	RAM memory
Vendor:	NVIDIA Corporation
Device:	MCP61 Memory Controller
SVendor:	Giga-byte Technology
SDevice:	Device 0c11
Rev:	a2

Slot:	00:02.0
Class:	USB controller
Vendor:	NVIDIA Corporation
Device:	MCP61 USB 1.1 Controller
SVendor:	Giga-byte Technology
SDevice:	Device 5004
Rev:	a2
ProgIf:	10

Slot:	00:02.1
Class:	USB controller
Vendor:	NVIDIA Corporation
Device:	MCP61 USB 2.0 Controller
SVendor:	Giga-byte Technology
SDevice:	Device 5004
Rev:	a2
ProgIf:	20

Slot:	00:04.0
Class:	PCI bridge
Vendor:	NVIDIA Corporation
Device:	MCP61 PCI bridge
Rev:	a1
ProgIf:	01

Slot:	00:05.0
Class:	Audio device
Vendor:	NVIDIA Corporation
Device:	MCP61 High Definition Audio
SVendor:	Giga-byte Technology
SDevice:	Device a002
Rev:	a2

Slot:	00:06.0
Class:	IDE interface
Vendor:	NVIDIA Corporation
Device:	MCP61 IDE
SVendor:	Giga-byte Technology
SDevice:	Device 5002
Rev:	a2
ProgIf:	8a

Slot:	00:07.0
Class:	Bridge
Vendor:	NVIDIA Corporation
Device:	MCP61 Ethernet
SVendor:	Giga-byte Technology
SDevice:	Device e000
Rev:	a2

Slot:	00:08.0
Class:	IDE interface
Vendor:	NVIDIA Corporation
Device:	MCP61 SATA Controller
SVendor:	Giga-byte Technology
SDevice:	Device b002
Rev:	a2
ProgIf:	85

Slot:	00:0d.0
Class:	VGA compatible controller
Vendor:	NVIDIA Corporation
Device:	C61 [GeForce 6150SE nForce 430]
SVendor:	Giga-byte Technology
SDevice:	Device d000
Rev:	a2

Slot:	00:18.0
Class:	Host bridge
Vendor:	Advanced Micro Devices [AMD]
Device:	K8 [Athlon64/Opteron] HyperTransport Technology Configuration

Slot:	00:18.1
Class:	Host bridge
Vendor:	Advanced Micro Devices [AMD]
Device:	K8 [Athlon64/Opteron] Address Map

Slot:	00:18.2
Class:	Host bridge
Vendor:	Advanced Micro Devices [AMD]
Device:	K8 [Athlon64/Opteron] DRAM Controller

Slot:	00:18.3
Class:	Host bridge
Vendor:	Advanced Micro Devices [AMD]
Device:	K8 [Athlon64/Opteron] Miscellaneous Control

Slot:	01:06.0
Class:	Ethernet controller
Vendor:	Belkin
Device:	F5D7000 v7000 Wireless G Desktop Card [Realtek RTL8185]
SVendor:	Belkin
SDevice:	F5D7000 v7000 Wireless G Desktop Card [Realtek RTL8185]
Rev:	20

$

GCC COMMANDLINE OPTIONS PART 2

commandline session

$gcc -S main.c > main.s
$cat main.s
.file "main.c"
.section .rodata
.LC0:
.string "n The Geek Stuff [%d]n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl -4(%rbp), %eax
movl %eax, %esi
movl $.LC0, %edi
movl $0, %eax
call printf
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 4.7.2-4) 4.7.2"
.section .note.GNU-stack,"",@progbits
$

GCC COMMANDLINE OPTIONS PART 1

commandline session

$cat main.c
#include<stdio.h>

int main(void)
{
printf("n The Geek Stuffn");
return 0;
}
$gcc main.c
$./a.out

The Geek Stuff
$gcc main.c -o main
$./main

The Geek Stuff
$gcc -Wall main.c -o main
$./main

The Geek Stuff
$cat main.c
#include<stdio.h>

int main(void)
{
int i;
printf("n The Geek Stuff [%d]n", i);
return 0;
}
$gcc -Wall main.c -o main
main.c: In function ‘main’:
main.c:6:10: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
$gcc -E main.c > main.i

FREE COMMAND WITH DIFFERENT UNITS

commandline session

$free -b
             total       used       free     shared    buffers     cached
Mem:    2043490304 1840762880  202727424          0   37040128  823631872
-/+ buffers/cache:  980090880 1063399424
Swap:   5984219136   15114240 5969104896
$free -k
             total       used       free     shared    buffers     cached
Mem:       1995596    1795388     200208          0      36196     804388
-/+ buffers/cache:     954804    1040792
Swap:      5843964      14760    5829204
$free -m
             total       used       free     shared    buffers     cached
Mem:          1948       1749        199          0         35        785
-/+ buffers/cache:        928       1020
Swap:         5706         14       5692
$free -g
             total       used       free     shared    buffers     cached
Mem:             1          1          0          0          0          0
-/+ buffers/cache:          0          0
Swap:            5          0          5
$

DEBIAN xrandr The X Resize, Rotate and Reflect Extension (RandR)

$xrandr | grep connected
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 340mm x 270mm
$xrandr --output VGA-0 --brightness 1
$xrandr --output VGA-0 --brightness 0.5
$

Theory Drop
The X Resize, Rotate and Reflect Extension (RandR)[2] is an X Window System extension, which allows clients to dynamically change X screens, so as to resize, rotate and reflect the root window of a screen.

source:http://en.wikipedia.org/wiki/RandR

UNIT TESTING trueprint

commandline session

$ls
acconfig.h  bootstrap  config.cache  config.log     configure.in  INSTALL      Makefile.in  replace  stamp-h1.in
aclocal.m4  ChangeLog  config.h      config.status  COPYING	  Makefile     NEWS	    src      stamp-h2.in
AUTHORS     config     config.h.in   configure	    doc		  Makefile.am  README	    stamp-h  tests
$make check
Makefile:122: warning: overriding commands for target `config.h'
Makefile:103: warning: ignoring old commands for target `config.h'
Makefile:132: warning: overriding commands for target `config.h.in'
Makefile:113: warning: ignoring old commands for target `config.h.in'
Making check in replace
make[1]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3/replace'
rm -f libreplace.a
ar cru libreplace.a
ranlib libreplace.a
make[1]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3/replace'
Making check in src
make[1]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3/src'
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c debug.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c index.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_verilog.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_perl.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c postscript.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c diffs.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c input.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c language.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_pike.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c print_prompt.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c expand_str.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_c.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c main.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_report.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c printers_fl.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c getopt.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_cxx.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c openpipe.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_sh.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c getopt1.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_java.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c options.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c utils.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c headers.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_text.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c lang_pascal.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I..   -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2 -c output.c
gcc -DPRINTERS_FILE="/usr/local/lib/printers" -g -O2  -o trueprint  debug.o index.o lang_verilog.o lang_perl.o postscript.o diffs.o input.o language.o lang_pike.o print_prompt.o expand_str.o lang_c.o main.o lang_report.o printers_fl.o getopt.o lang_cxx.o openpipe.o lang_sh.o getopt1.o lang_java.o options.o utils.o headers.o lang_text.o lang_pascal.o output.o
make[1]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3/src'
Making check in doc
make[1]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3/doc'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3/doc'
Making check in tests
make[1]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3/tests'
make  check-TESTS
make[2]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3/tests'
top_builddir = ..
srcdir = .
1 Single C source file... passed
2 Two C source files... passed
3 Text file followed by C source file... passed
4 Diff of two files... passed
5 Diff of two files with long options... passed
6 Another diff of two files... passed
7 Another diff of two files with long options... passed
8 Diffs using a prefix... passed
9 Diffs using a prefix with long options... passed
10 Very long source line... passed
11 Set interline gap & pointsize & page length -g -p -l... passed
12 Set interline gap & pointsize & page length with long options... passed
13 Change date & time in headers -X... passed
14 Change date & time in headers with long options... passed
15 Use login name in headers -X %l... passed
16 Use login name in headers --left-header=%l... passed
17 Print message over page -m... passed
18 Print message over page --message... passed
19 Use current filename for message string -m %n... passed
20 Use current filename for message string --message %n... passed
21 Use landscape mode -ol... passed
22 Use landscape mode with long option... passed
23 Print 2-on-1 -2... passed
24 Print 2-on-1 --two-up... passed
25 Print 4-on-1 -4... passed
26 Print 4-on-1 --four-up... passed
27 Long lines & page width -w... passed
28 Long lines & page width --line-wrap... passed
29 Turn off intelligent linewrap -Wn... passed
30 Turn off intelligent linewrap with long options... passed
31 Exclude braces depth count for C, line number count -in -nn... passed
32 Exclude braces depth count for C, line number count with long options... passed
33 Print double-sided -S2... passed
34 Print double-sided --double-sided... passed
35 Suppress everything -C -F -f -B... passed
36 Suppress everything using long options... passed
37 Set tabsize wierdly -T5... passed
38 Set tabsize wierdly using long option... passed
39 Set headers/footers... passed
40 Set headers/footers using long options... passed
41 Indent for holepunch --I... passed
42 Indent for holepunch using long options... passed
43 Suppress headers --K... passed
44 Suppress headers using long options... passed
45 Suppress footers --k... passed
46 Suppress footers using long options... passed
47 Stdin for default... passed
48 - for stdin... passed
49 No new sheet for new filepassed
49 out of 49 tests passed
To complete the test, print a file using trueprint
PASS: Run
==================
All 1 tests passed
==================
make[2]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3/tests'
make[1]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3/tests'
make[1]: Entering directory `/home/jeffrin/unit.test/trueprint-5.3'
Makefile:122: warning: overriding commands for target `config.h'
Makefile:103: warning: ignoring old commands for target `config.h'
Makefile:132: warning: overriding commands for target `config.h.in'
Makefile:113: warning: ignoring old commands for target `config.h.in'
cd . 
	  && CONFIG_FILES= CONFIG_HEADERS=config.h 
	     /bin/sh ./config.status
creating config.h
config.h is unchanged
cd . 
	  && CONFIG_FILES= CONFIG_HEADERS=config.h 
	     /bin/sh ./config.status
creating config.h
config.h is unchanged
make[1]: Leaving directory `/home/jeffrin/unit.test/trueprint-5.3'
$

TEE . read from standard input and write to standard output and files

commandline session

$stat version.c
  File: `version.c'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d	Inode: 5415089     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ jeffrin)   Gid: ( 1000/ jeffrin)
Access: 2013-01-07 19:05:13.000000000 +0530
Modify: 2013-01-07 21:55:50.000000000 +0530
Change: 2013-01-07 21:55:50.000000000 +0530
 Birth: -
$stat version.c | tee newversion.c
  File: `version.c'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d	Inode: 5415089     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ jeffrin)   Gid: ( 1000/ jeffrin)
Access: 2013-01-07 19:05:13.000000000 +0530
Modify: 2013-01-07 21:55:50.000000000 +0530
Change: 2013-01-07 21:55:50.000000000 +0530
 Birth: -
$cat newversion.c
  File: `version.c'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d	Inode: 5415089     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ jeffrin)   Gid: ( 1000/ jeffrin)
Access: 2013-01-07 19:05:13.000000000 +0530
Modify: 2013-01-07 21:55:50.000000000 +0530
Change: 2013-01-07 21:55:50.000000000 +0530
 Birth: -
$

TCPDUMP . PRINT LESS PROTOCOL INFORMATION . OUTPUT LINES SHORTER

$sudo /usr/sbin/tcpdump -q
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 100535 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel
$sudo /usr/sbin/tcpdump -q -i wlan0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 100535 bytes
22:53:57.772687 IP ubuntu.ftp.heanet.ie.http > debian.local.33649: tcp 1430
22:53:57.772898 IP debian.local.33649 > ubuntu.ftp.heanet.ie.http: tcp 0
^C22:53:57.777681 IP debian.local.51260 > 192.168.0.1.domain: UDP, length 44

3 packets captured
458 packets received by filter
422 packets dropped by kernel
$

UPGRADE A PACKAGE AND IT'S DEPENDENCIES USING APT-GET

root@debian:~# apt-get install $(apt-cache depends gnome-session | grep Depends | sed "s/.*ends: //" | tr 'n' ' ')
Reading package lists... Done
Building dependency tree
Reading state information... Done
gnome-session-bin is already the newest version.
gnome-session-bin set to manually installed.
gnome-session-common is already the newest version.
gnome-session-common set to manually installed.
The following extra packages will be installed:
  gkbd-capplet gnome-shell-common libebook-1.2-13 libecal-1.2-11 libedataserver-1.2-16 libedataserverui-3.0-1 libgjs0b
The following NEW packages will be installed:
  gkbd-capplet
The following packages will be upgraded:
  gnome-settings-daemon gnome-shell gnome-shell-common libebook-1.2-13 libecal-1.2-11 libedataserver-1.2-16
  libedataserverui-3.0-1 libgjs0b
8 upgraded, 1 newly installed, 0 to remove and 1026 not upgraded.
Need to get 958 kB/4,159 kB of archives.
After this operation, 151 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 ftp://ftp.iitm.ac.in/debian/ sid/main gkbd-capplet amd64 3.4.0.2-1 [14.0 kB]
Get:2 ftp://ftp.iitm.ac.in/debian/ sid/main gnome-shell amd64 3.4.2-4 [280 kB]
Get:3 ftp://ftp.iitm.ac.in/debian/ sid/main gnome-shell-common all 3.4.2-4 [664 kB]
Fetched 958 kB in 4s (194 kB/s)
(Reading database ... 394386 files and directories currently installed.)
Preparing to replace gnome-settings-daemon 3.4.2+git20120925.a4c817-1 (using .../gnome-settings-daemon_3.4.2+git20121218.7c1322-1_amd64.deb) ...
Unpacking replacement gnome-settings-daemon ...
Selecting previously unselected package gkbd-capplet.
Unpacking gkbd-capplet (from .../gkbd-capplet_3.4.0.2-1_amd64.deb) ...
Preparing to replace gnome-shell 3.4.2-2 (using .../gnome-shell_3.4.2-4_amd64.deb) ...
Unpacking replacement gnome-shell ...
Preparing to replace gnome-shell-common 3.4.2-2 (using .../gnome-shell-common_3.4.2-4_all.deb) ...
Unpacking replacement gnome-shell-common ...
Preparing to replace libedataserver-1.2-16 3.4.3-1 (using .../libedataserver-1.2-16_3.4.4-1_amd64.deb) ...
Unpacking replacement libedataserver-1.2-16 ...
Preparing to replace libebook-1.2-13 3.4.3-1 (using .../libebook-1.2-13_3.4.4-1_amd64.deb) ...
Unpacking replacement libebook-1.2-13 ...
Preparing to replace libecal-1.2-11 3.4.3-1 (using .../libecal-1.2-11_3.4.4-1_amd64.deb) ...
Unpacking replacement libecal-1.2-11 ...
Preparing to replace libedataserverui-3.0-1 3.4.3-1 (using .../libedataserverui-3.0-1_3.4.4-1_amd64.deb) ...
Unpacking replacement libedataserverui-3.0-1 ...
Preparing to replace libgjs0b 1.32.0-2 (using .../libgjs0b_1.32.0-4_amd64.deb) ...
Unpacking replacement libgjs0b ...
Processing triggers for libglib2.0-0:amd64 ...
Processing triggers for man-db ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Setting up gnome-settings-daemon (3.4.2+git20121218.7c1322-1) ...
Setting up gkbd-capplet (3.4.0.2-1) ...
Setting up libedataserver-1.2-16 (3.4.4-1) ...
Setting up libebook-1.2-13 (3.4.4-1) ...
Setting up libecal-1.2-11 (3.4.4-1) ...
Setting up libedataserverui-3.0-1 (3.4.4-1) ...
Setting up libgjs0b (1.32.0-4) ...
Setting up gnome-shell-common (3.4.2-4) ...
Setting up gnome-shell (3.4.2-4) ...
root@debian:~#