Feeds:
Posts
Comments

Archive for January 8th, 2008

Below are the common commands that are used in Linux. Although many Linux Distros provide a good GUI (graphical user interface), there are a lot of linux-ers still exciting to use these Command Lines. Me, myself, I use it everyday. If you know how to use it, you can setup your system in seconds.

For example, when you to change your ip address (192.168.0.2) and ip gateway (192.168.0.1) from DHCP to static through GUI, at least you need at about 25 seconds. If you are get used to with Command Lines you can set it in less than 15 seconds. Because, what you need it is only open the Linux terminal and type:

$sudo ifconfig eth0 192.168.0.2 netmask 255.255.255.0
$sudo route add default gw 192.168.0.1

If you want to know what is ‘the function for a command line that you find’ and dig more information about it, you can use these commands.

For example, if you want to know what is ‘chage’, then just type.

taufanlubis@toshiba:~$ whatis chage

Then, when you want to go into details, just type:

taufanlubis@toshiba:~$ man chage (to quit type ‘:‘ then ‘q‘)

 

chage – change user password expiry information.

taufanlubis@toshiba:~$ man chage (check the manual)

taufanlubis@toshiba:~$ chage -l taufanlubis

Last password change : Nov 18, 2007
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

taufanlubis@toshiba:~$

 

uname – to check kernel version (print system information)
taufanlubis@toshiba:~$ uname

Linux

taufanlubis@toshiba:~$ uname -r
2.6.22-14-generic

 

pwd – print name of current/working directory
taufanlubis@toshiba:~$ pwd
/home/taufanlubis

 

date – print or set the system date and time
taufanlubis@toshiba:~$ date
Sat Dec 29 06:34:36 WIT 2007

 

cal – display a calendar
taufanlubis@toshiba:~$ cal (display current month)
December 2007
Su Mo Tu We Th Fr Sa
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

 

taufanlubis@toshiba:~$ cal -3 (display previous/current/next month output).

taufanlubis@toshiba:~$ cal -m 10 1970 (display October 1970 and Monday as the first day of the week).
October 1970
Mo Tu We Th Fr Sa Su
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

taufanlubis@toshiba:~$

 

w – Show who is logged on and what they are doing
taufanlubis@toshiba:~$ w
06:44:07 up 1:01, 2 users, load average: 0.21, 0.10, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
taufanlu tty7 :0 05:43 0.00s 1:30m 0.14s x-session-manager
taufanlu pts/0 :0.0 06:25 0.00s 0.16s 0.00s w

taufanlubis@toshiba:~$

 

whoami – account information (print effective userid)
taufanlubis@toshiba:~$ whoami
taufanlubis

 


who – show who is logged on

taufanlubis@toshiba:~$ who
taufanlubis tty7 2007-12-29 05:43 (:0)
taufanlubis pts/0 2007-12-29 06:25 (:0.0)

taufanlubis@toshiba:~$

 


lspci – List all PCI devices

taufanlubis@toshiba:~$ lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8039 PCI-E Fast Ethernet Controller (rev 14)
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
07:06.0 CardBus bridge: Texas Instruments PCIxx12 Cardbus Controller
07:06.1 FireWire (IEEE 1394): Texas Instruments PCIxx12 OHCI Compliant IEEE 1394 Host Controller
07:06.2 Mass storage controller: Texas Instruments 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)
07:06.3 Generic system peripheral [0805]: Texas Instruments PCIxx12 SDA Standard Compliant SD Host Controller

taufanlubis@toshiba:~$

 

The 3 codes on the left represent:

  • domain (0 to ffff)

  • bus (0 to ff)

  • slot (0 to 1f)

For example, if you want to see your USB controller (domain 00), (bus 1d) and slot (0,1,2,3,7), then you have to type:
taufanlubis@toshiba:~$ lspci -s 00:1d

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)

taufanlubis@toshiba:~$

taufanlubis@toshiba:~$ lspci -s 00:1d.3
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
taufanlubis@toshiba:~$

 

taufanlubis@toshiba:~$ lspci -d 8086:4222 (Show only devices with specified vendor and device ID)
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
taufanlubis@toshiba:~$

 

Note:
Usage: lspci [<switches>]
-v Be verbose
-n Show numeric ID’s
-nn Show both textual and numeric ID’s (names & numbers)
-b Bus-centric view (PCI addresses and IRQ’s instead of those seen by the CPU)
-x Show hex-dump of the standard portion of config space
-xxx Show hex-dump of the whole config space (dangerous; root only)
-xxxx Show hex-dump of the 4096-byte extended config space (root only)
-s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]] Show only devices in selected slots
-d [<vendor>]:[<device>] Show only selected devices
-t show bus tree
-m Produce machine-readable output
-i <file>Use specified ID database instead of /usr/share/misc/pci.ids.gz
-D Always show domain numbers
-M Enable `bus mapping’ mode (dangerous; root only)
-P <dir>Use specified directory instead of /proc/bus/pci
-H <mode>Use direct hardware access (<mode> = 1 or 2)
-F <file>Read configuration data from given file
-G Enable PCI access debugging

 

 

Read Full Post »

Follow

Get every new post delivered to your Inbox.

Join 70 other followers