This blog is made for Expressing My Ideas, Views, and to put some technical datas.
Monday, September 27, 2010
Get familiar with the VIM editor
This text will provide you information about the Linux / Unix vi text editor and it's options.
SYNTAX
vi [ -| -s ] [-l] [-L] [-R] [ -r [ filename ] ] [-S] [-t tag] [-v] [-V] [-x] [-w] [-n ] [-C] [+command | -c command ] filename
- | -s Suppress all interactive user feedback. This is useful when processing editor scripts.
-l Set up for editing LISP programs.
-L List the name of all files saved as the result of an editor or system crash.
-R Readonly mode; the readonly flag is set, preventing accidental overwriting of the file.
-r filename Edit filename after an editor or system crash. (Recovers the version of filename that was in the buffer when the crash occurred.)
-S This option is used in conjunction with the -t tag option to tell vi that the tags file may not be sorted and that, if the binary search (which relies on a sorted tags file) for tag fails to find it, the much slower linear search should also be done. Since the linear search is slow, users of large tags files should ensure that the tags files are sorted rather than use this flag. Creation of tags files normally produces sorted tags files. See ctags for more information on tags files.
-t tag Edit the file containing the tag, tag, and position the editor at its definition.
-v Start up in display editing state using vi . You can achieve the same effect by simply typing the vi command itself.
-V Verbose. When ex commands are read by means of standard input, the input will be echoed to standard error. This may be useful when processing ex commands within shell scripts.
-x Encryption option; when used, vi simulates the X command of ex and prompts the user for a key. This key is used to encrypt and decrypt text using the algorithm of the crypt command. The X command makes an educated guess to determine whether text read in is encrypted or not. The temporary buffer file is encrypted also, using a transformed version of the key typed in for the -x option. If an empty encryption key is entered (that is, if the return key is pressed right after the prompt), the file will not be encrypted. This is a good way to decrypt a file erroneously encrypted with a mistyped encryption key, such as a backspace or undo key.
-wn Set the default window size to n. This is useful when using the editor over a slow speed line.
-C Encryption option; same as the -x option, except that vi simulates the C command of ex . The C command is like the X command of ex , except that all text read in is assumed to have been encrypted.
+command | -c command Begin editing by executing the specified editor
command (usually a search or positioning command).
filename The file to be edited.
USER COMMANDS
Arrow keys Move cursor
hjkl Same as arrow keys
itextESC Insert text
cwnewESC Change word to new
easESC pluralize word (end of word; append s; escape from input state)
x delete a character
dw delete a word
dd delete a line
3dd deletes 3 lines
u undo previous change
ZZ exit vi , saving changes
:q!CR quit, discarding changes
/textCR search for text
^U ^D scroll up or down
:cmdCR any ex or ed command
ESC end insert or incomplete command
DEL (delete or rubout) interrupts
:wCR write back changes
:w!CR forced write, if permission originally not valid
:qCR quit
:q!CR quit, discard changes
:e nameCR edit file name
:e!CR reedit, discard changes
:e + nameCR edit, starting at end
:e +nCR edit, starting at line n
:e #CR edit alternate file
:e! #CR edit alternate file, discard changes
:w nameCR write file name
:w! nameCR overwrite file name
:shCR run shell, then return
:!cmdCR run cmd, then return
:nCR edit next file in arglist
:n argsCR specify new arglist
^G show current file and line
:ta tagCR position cursor to tag
F forward screen
^B backward screen
^D scroll down half screen
^U scroll up half screen
nG go to the beginning of the specified line (end default), where n is a line number
/pat next line matching pat
?pat previous line matching pat
n repeat last / or ? command
N reverse last / or ? command
/pat/+n nth line after pat
?pat?-n nth line before pat
]] next section/function
[[ previous section/function
( beginning of sentence
) end of sentence
{ beginning of paragraph
} end of paragraph
% find matching ( ) or { }
^L clear and redraw window
^R clear and redraw window if ^L is -> key
zCR redraw screen with current line at top of window
z-CR redraw screen with current line at bottom of window
z.CR redraw screen with current line at center of window
/pat/z-CR move pat line to bottom of window
zn.CR use n-line window
^E scroll window down one line
^Y scroll window up one line
`` move cursor to previous context
\'\' move cursor to first non-white space in line
mx mark current position with the ASCII lower-case letter x
`x move cursor to mark x
\'x move cursor to first non-white space in line marked by x
H top line on screen
L last line on screen
M middle line on screen
+ next line, at first non-white space character
- previous line, at first non-white space character
CR return, same as +
down-arrow or j next line, same column
up-arrow or k previous line, same column
^ first non-white space character
0 beginning of line
$ end of line
l or -> forward
h or <- backward
^H same as <- (backspace)
space same as -> (space bar)
fx find next x
Fx find next x
tx move to character following the next x
Tx move to character following the previous x
; repeat last f, F, t, or T
, repeat inverse of last f, F, t, or T
n| move to column n
% find matching ( ) or { }
w forward a word
b back a word
e end of word
) to next sentence
} to next paragraph
( back a sentence
{ back a paragraph
W forward a blank-delimited word
B back a blank-delimited word
E end of a blank-delimited word
^H erase last character (backspace)
^W erase last word
erase your erase character, same as ^H (backspace)
kill your kill character, erase this line of input
\\ quotes your erase and kill characters
ESC ends insertion, back to command mode
CTRL-C interrupt, suspends insert mode
^D backtab one character; reset left margin of autoindent
^^D caret (^) followed by control-d (^D); backtab to beginning of line; do not reset left margin of autoindent
0^D backtab to beginning of line; reset left margin of autoindent
^V quote non-printable character
a append after cursor
A append at end of line
i insert before cursor
I insert before first non-blank
o open line below
O open line above
rx replace single character with x
RtextESC replace characters
d delete
c change
y yank lines to buffer
> left shift
< right shift
! filter through command
C change rest of line (c$)
D delete rest of line (d$)
s substitute characters (cl)
S substitute lines (cc)
J join lines
x delete characters (dl)
X delete characters before cursor dh)
Y yank lines (yy)
3yy yank 3 lines
3yl yank 3 characters
p put back text after cursor
P put back text before cursor \" .nr )I xp\"n
put from buffer x \" .nr )I xy\"n
yank to buffer x \" .nr )I xd\"n
delete into buffer x
u undo last change
U restore current line
. repeat last change \" .nr )I dp\"n
retrieve d\'th last delete
Linux: How to check the hardware
I've noticed there are no good tutorials on how to check what hardware you have installed on your machine. In Linux there are many ways doing this so it's not an issue but you have to know the needed commands.
I'll start step by step checking different devices on your computer but there is a tool wich shows all so if you don't want to read much just scroll down to the lshw command.
Check on the CPU:
Here is the command that will help you to see what CPU you have installed:
root@Linux ~# cat /proc/cpuinfo
This will print the whole needed information for your CPU. Here is an example:
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Celeron(R) CPU 2.40GHz
stepping : 9
cpu MHz : 2400.485
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe up pebs bts cid xtpr
bogomips : 4805.18
clflush size : 64
Checking VGA, LAN and wireless adapters, chipset etc:
root@Linux ~# lspci
Example result:
00:00.0 Host bridge: Intel Corporation 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)
00:02.0 VGA compatible controller: Intel Corporation 82865G Integrated Graphics Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)
00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)
01:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
Checking the hard drives:
root@Linux ~# fdisk -l
Example:
isk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x90909090
Device Boot Start End Blocks Id System
/dev/hda1 1 13 104391 83 Linux
/dev/hda2 14 139 1012095 82 Linux swap / Solaris
/dev/hda3 140 9729 77031675 83 Linux
lshw
The easiest way to check all the hardware installed on your box is the lshw command.
Using this command you can see all the hardware. Use the update manager of your distribution to install it if the command line says that the command doesn't exist. The package name is lshw as well.
root@Linux ~# lshw
I won't paste an example for this command since the result is always too huge but it lists everything you need to know.
I hope it was helpful.
How To Check Which Port Is Listening or Open on Linux
For some security reason you may configure SSH or any other protocol using different kind of port number on Linux server. Sometimes it?s important to know which ports are actually listen or open to the system network, it may open for network instruction or hacking.
Basically there are few methods to see which ports are open on Linux.
Option 1:
Check /etc/services file
planetmy:/ # cat /etc/services | grep xxx (xxx = port number)
If the command return no output mean no port configure to listen on the particular port number. For port SSH/22, you should be able to see:
ssh 22/tcp # SSH Remote Login Protocol
ssh 22/udp # SSH Remote Login Protocol
Option 2:
Use netstat command - Print network connections, routing tables, interface statistics, masquerade connections, and multi cast memberships.
planetmy:/ # netstat -nan | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7110/sshd
If the command output return ?LISTEN?, mean the particular port is open or listen on network.
Option 3:
use lsof command - list open files
planetmy:/ # lsof -i -n -P|grep 631
cupsd 17934 lp 0u IPv4 56540196 TCP *:631 (LISTEN)
cupsd 17934 lp 2u IPv4 56540197 UDP *:631
Option 4:
use nmap command - Network exploration tool and security scanner
planetmy:/ # nmap -sS -O 192.168.1.2
Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2008-09-12 10:13 GMT
Interesting ports on 192.168.1.2:
(The 1655 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
427/tcp open svrloc
631/tcp open ipp
Device type: general purpose
Running: Linux 2.4.X|2.5.X
OS details: Linux Kernel 2.4.0 - 2.5.20, Linux Kernel 2.4.18 - 2.5.70 (X86)
Nmap run completed ? 1 IP address (1 host up) scanned in 4.146 seconds
The output show the system is running SSH on port 22.
Option 5:
use telnet command - user interface to the TELNET protocol
planetmy:/ # telnet 192.168.1.2 22
Trying 192.168.1.2?
Connected to 192.168.1.2.
Escape character is ?^]?.
SSH-1.99-OpenSSH_4.2
The output show as above mean SSH port 22 is listening on the network
planetmy:/ # telnet 192.168.1.2 122
Trying 192.168.1.2?
telnet: connect to address 192.168.1.2: Connection refused
The output show as above mean port 122 is closed.
Thanks to:
http://www.freecodeclub.com/
Setting Up Your Own Station: A Free Radio Under Linux HowTo
1. Introduction
So, you want to create your own radio station, don’t you? This manual will help you become a DJ.
2. System Requirements
Minimal requirements for radio broadcasting through your own computer, most of which you are already aware of:
*
150 MHz processor, or better
*
32 MB RAM
*
cable, DSL, or any other kind of broadband internet
and a little free hard disk space for mp3s (which you are going to play).
OS:
*
Some up-to-date Linux distribution, kernel 2.2 or newer.
Software:
*
XMMS 1.2.x http://www.xmms.org/
*
LAME v3.x http://www.sulaco.org/mp3
*
Icecast 1.3.x http://www.icecast.org/
*
Liveice-XMMS. http://star.arm.ac.uk/~spm/software/liveice.html
If using Debian, you can also use:
apt-get install xmms icecast-server
to install xmms and Icecast server. According to LAME, you can use a program called Alien, to convert RPM pack into Debian pack. All you have to do is:
apt-get install alien
and then, as root:
alien package.rpm
to create .deb which you can install, using
dpkg –i
where the name of the Debian package is.
3. Installation
The installation should be rather right-minded. You already should have all packages you need, in order to make things work. If compiling from source, then you should compile and install the software as it is described in its documentation.
If using RedHat, or any of its relative ones you can search for RPM, and download and install it by
rpm –Uvh
where the name of the RPM, which you use is.
If using Debian, just write
apt-get install xmms
icecast-server
to install xmms and Icecast server. According to LAME, you can use a program called Alien, to convert RPM package into Debian package. Install it:
apt-get install alien
then you can use it as root:
alien package.rpm
and the packages can be installed by using
dpkg –i
followed by the package’s name. For example:
dpkg -i
And don’t forget that you should be root to do most of the above. And now, after the installation of all programs you need we have to set them in order to work properly.
4. Configuration
First of all we should configure the Icecast server. Find the directory which contains the Icecast server configuration files (in my case it was /etc/icecast, and I suppose it’s the same if installed by RPM; if you compiled the program on your own, then you are prepared well enough to know where the settings should be) and there you should have many “.dist”-files. Now rename all that files by deleting the “.dist” part. For example if the file name is “icecast.conf.dist” the new one should be “icecast.conf”. If there are no more “.dist”-files then you are doing well.
Now open icecast.conf with your favorite editor. The configuration is rather right-minded and simple, but anyway I’ll guide you through it. Near the beginning of the file you’ll find location/information fields:
location Just west of Mars
rp_email kirk@enterprise.space
server_url http://www.icecast.org/
fill them with the information, that you want people to see, when visiting your web-radio-station.
The next section you have to look at is the one for the server limit:
max_clients 900
max_clients_per_source 900
max_sources 10
max_admins 5
throttle 10.0
For most of the users this is much more than enough. Just set the parameters according to the speed of your Internet connection. Probably you’ll prefer
max_clients
and
max_clients_per_source
to be set at 10, and the rest you can leave the way it is. Now go down the file while you reach:
encoder_password hackme
admin_password hackme
oper_password hackme
If installed the Icecast server under Debian, or support of encrypted passwords enabled, you should crypt the password in this file using program, called mkpasswd (which probably you already have installed on your system). To do this use:
mkpasswd
Then copy and paste the result in the file. It should look like this:
encoder_passwd --WZKu0fXj3bQ
admin_passwd --WZKu0fXj3bQ
oper_passwd --WZKu0fXj3bQ
No matter which way of installation you made, you should change the password into something else than “hackme”. In the common case the three passwords should be the same. Remember the password you use, because you will use it latter during the configuration of the Liveice-XMMS.
Go down the file again and find:
console_mode 0
change the value at 3, that way the loading will be in text mode.
Usually you don’t have to change the rest of the configuration file. The advanced users can look through the rest of the settings.
Now, let’s configure the Liveice-XMMS:
Restart the XMMS, in order to make it possible to notice that there is another plugin. Make right click on the XMMS and choose Preferences. Go to Effect/General Plugins. In the list under Effect Plugins you should find Liveince. In case you can’t find it check out the Liveice-XMMS installation. After choosing Liveince, click on Configure.
Most of these audio format settings are standard, so you won’t have to change them much. Change the “Encoder type” to ‘Lame’, and the “executable name” to ‘Lame’. If already have any version of Lame on your machine, then set the path to it. Under “Description” you can consider the exact changes by yourself.
Go to Server and change the “Encoder Password” into the one that’s written in the Icecast configuration (and I told you to remember). You shouldn't type the password in encrypted mode if you have encrypted it.
Now everything is set and ready. Click OK. Check “Use Plugins” in the dialog “Preferences”, which should still be in front of you, and click OK again.
In terminal window type ‘icecast’ and press Enter. You should see how it’s getting started and proceeds into text mode.
If you are listening to a song, stop it and play it again.
Nothing went wrong…? There wasn’t big BANG!!! I hope so!
Ask a friend to connect to your IP through XMMS or any other mp3-player at http://yourcomputer:8000 … there should be music playing! If this is not happening, check out the FAQ to solve the problem.
If everything is OK, congratulations – you are now a DJ!
5. FAQ
Make sure that Icecast works. If the problems are still there, go to the conf file, at the place where you changed console_mode to 3, and change it back to 0 (that way you can receive some debug messages). You should be connecting as source, other ways check the Liveice settings. If you are connected as ‘source’, or as ‘encoder’, and your friend is trying to connect, but you don’t receive a message for this, then the problem is not in you!
Linux advanced commands
Linux advanced commands
| Command | Description | |
|
| apropos whatis | Show commands pertinent to string. See also threadsafe |
|
| man -t man | ps2pdf - > man.pdf | make a pdf of a manual page |
|
| which command | Show full path name of command |
|
| time command | See how long a command takes |
|
| time cat | Start stopwatch. Ctrl-d to stop. See also sw |
|
| nice info | Run a low priority command (The "info" reader in this case) |
|
| renice 19 -p $$ | Make shell (script) low priority. Use for non interactive tasks |
| dir navigation | ||
|
| cd - | Go to previous directory |
|
| cd | Go to $HOME directory |
|
| (cd dir && command) | Go to dir, execute command and return to current dir |
|
| pushd . | Put current dir on stack so you can popd back to it |
| file searching | ||
|
| alias l='ls -l --color=auto' | quick dir listing |
|
| ls -lrt | List files by date. See also newest and find_mm_yyyy |
|
| ls /usr/bin | pr -T9 -W$COLUMNS | Print in 9 columns to width of terminal |
|
| find -name '*.[ch]' | xargs grep -E 'expr' | Search 'expr' in this dir and below. See also findrepo |
|
| find -type f -print0 | xargs -r0 grep -F 'example' | Search all regular files for 'example' in this dir and below |
|
| find -maxdepth 1 -type f | xargs grep -F 'example' | Search all regular files for 'example' in this dir |
|
| find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done | Process each item with multiple commands (in while loop) |
|
| find -type f ! -perm -444 | Find files not readable by all (useful for web site) |
|
| find -type d ! -perm -111 | Find dirs not accessible by all (useful for web site) |
|
| locate -r 'file[^/]*\.txt' | Search cached index for names. This re is like glob *file*.txt |
|
| look reference | Quickly search (sorted) dictionary for prefix |
|
| grep --color reference /usr/share/dict/words | Highlight occurances of regular expression in dictionary |
| archives and compression | ||
|
| gpg -c file | Encrypt file |
|
| gpg file.gpg | Decrypt file |
|
| tar -c dir/ | bzip2 > dir.tar.bz2 | Make compressed archive of dir/ |
|
| bzip2 -dc dir.tar.bz2 | tar -x | Extract archive (use gzip instead of bzip2 for tar.gz files) |
|
| tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg' | Make encrypted archive of dir/ on remote machine |
|
| find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 > dir_txt.tar.bz2 | Make archive of subset of dir/ and below |
|
| find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents | Make copy of subset of dir/ and below |
|
| ( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) copy/ dir to /where/to/ dir |
|
| ( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) contents of copy/ dir to /where/to/ |
|
| ( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ && tar -x -p' | Copy (with permissions) copy/ dir to remote:/where/to/ dir |
|
| dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz' | Backup harddisk to remote machine |
| rsync (Use the --dry-run option for testing) | ||
|
| rsync -P rsync://rsync.server.com/path/to/file file | Only get diffs. Do multiple times for troublesome downloads |
|
| rsync --bwlimit=1000 fromfile tofile | Locally copy with rate limit. It's like nice for I/O |
|
| rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html' | Mirror web site (using compression and encryption) |
|
| rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/ | Synchronize current directory with remote one |
| ssh (Secure SHell) | ||
|
| ssh $USER@$HOST command | Run command on $HOST as $USER (default command=shell) |
|
| ssh -f -Y $USER@$HOSTNAME xeyes | Run GUI command on $HOSTNAME as $USER |
|
| scp -p -r $USER@$HOST: file dir/ | Copy with permissions to $USER's home directory on $HOST |
|
| ssh -g -L 8080:localhost:80 root@$HOST | Forward connections to $HOSTNAME:8080 out to $HOST:80 |
|
| ssh -R 1434:imap:143 root@$HOST | Forward connections from $HOST:1434 in to imap:143 |
| wget (multi purpose download tool) | ||
|
| (cd cmdline && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html) | Store local browsable version of a page to the current dir |
|
| wget -c http://www.example.com/large.file | Continue downloading a partially downloaded file |
|
| wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/ | Download a set of files to the current directory |
|
| wget ftp://remote/file[1-9].iso/ | FTP supports globbing directly |
|
| wget -q -O- http://www.pixelbeat.org/timeline.html | grep 'a href' | head | Process output directly |
|
| echo 'wget url' | at 01:00 | Download url at 1AM to current dir |
|
| wget --limit-rate=20k url | Do a low priority download (limit to 20KB/s in this case) |
|
| wget -nv --spider --force-html -i bookmarks.html | Check links in a file |
|
| wget --mirror http://www.example.com/ | Efficiently update a local copy of a site (handy from cron) |
| networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete) | ||
|
| ethtool eth0 | Show status of ethernet interface eth0 |
|
| ethtool --change eth0 autoneg off speed 100 duplex full | Manually set ethernet interface speed |
|
| iwconfig eth1 | Show status of wireless interface eth1 |
|
| iwconfig eth1 rate 1Mb/s fixed | Manually set wireless interface speed |
|
| iwlist scan | List wireless networks in range |
|
| ip link show | List network interfaces |
|
| ip link set dev eth0 name wan | Rename interface eth0 to wan |
|
| ip link set dev eth0 up | Bring interface eth0 up (or down) |
|
| ip addr show | List addresses for interfaces |
|
| ip addr add 1.2.3.4/24 brd + dev eth0 | Add (or del) ip and mask (255.255.255.0) |
|
| ip route show | List routing table |
|
| ip route add default via 1.2.3.254 | Set default gateway to 1.2.3.254 |
|
| tc qdisc add dev lo root handle 1:0 netem delay 20msec | Add 20ms latency to loopback device (for testing) |
|
| tc qdisc del dev lo root | Remove latency added above |
|
| host pixelbeat.org | Lookup DNS ip address for name or vice versa |
|
| hostname -i | Lookup local ip address (equivalent to host `hostname`) |
|
| whois pixelbeat.org | Lookup whois info for hostname or ip address |
|
| netstat -tupl | List internet services on a system |
|
| netstat -tup | List active connections to/from system |
| windows networking (Note samba is the package that provides all this windows specific networking support) | ||
|
| smbtree | Find windows machines. See also findsmb |
|
| nmblookup -A 1.2.3.4 | Find the windows (netbios) name associated with ip address |
|
| smbclient -L windows_box | List shares on windows machine or samba server |
|
| mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share | Mount a windows share |
|
| echo 'message' | smbclient -M windows_box | Send popup to windows machine (off by default in XP sp2) |
| text manipulation (Note sed uses stdin and stdout, so if you want to edit files, append | ||
|
| sed 's/string1/string2/g' | Replace string1 with string2 |
|
| sed 's/\(.*\)1/\12/g' | Modify anystring1 to anystring2 |
|
| sed '/ *#/d; /^ *$/d' | Remove comments and blank lines |
|
| sed ':a; /\\$/N; s/\\\n//; ta' | Concatenate lines with trailing \ |
|
| sed 's/[ \t]*$//' | Remove trailing spaces from lines |
|
| sed 's/\([\\`\\"$\\\\]\)/\\\1/g' | Escape shell metacharacters active within double quotes |
|
| seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/" | Right align numbers |
|
| sed -n '1000p;1000q' | Print 1000th line |
|
| sed -n '10,20p;20q' | Print lines 10 to 20 |
|
| sed -n 's/.* | Extract title from HTML web page |
|
| sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | Sort IPV4 ip addresses |
|
| echo 'Test' | tr '[:lower:]' '[:upper:]' | Case conversion |
|
| tr -dc '[:print:]' < /dev/urandom | Filter non printable characters |
|
| history | wc -l | Count lines |
| set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file) | ||
|
| sort file1 file2 | uniq | Union of unsorted files |
|
| sort file1 file2 | uniq -d | Intersection of unsorted files |
|
| sort file1 file1 file2 | uniq -u | Difference of unsorted files |
|
| sort file1 file2 | uniq -u | Symmetric Difference of unsorted files |
|
| join -a1 -a2 file1 file2 | Union of sorted files |
|
| join file1 file2 | Intersection of sorted files |
|
| join -v2 file1 file2 | Difference of sorted files |
|
| join -v1 -v2 file1 file2 | Symmetric Difference of sorted files |
| math | ||
|
| echo '(1 + sqrt(5))/2' | bc -l | Quick math (Calculate f). See also bc |
|
| echo 'pad=20; min=64; (100*10^6)/((pad+min)*8)' | bc | More complex (int) e.g. This shows max FastE packet rate |
|
| echo 'pad=20; min=64; print (100E6)/((pad+min)*8)' | python | Python handles scientific notation |
|
| echo 'pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)' | gnuplot -persist | Plot FastE packet rate vs packet size |
|
| echo 'obase=16; ibase=10; 64206' | bc | Base conversion (decimal to hexadecimal) |
|
| echo $((0x2dec)) | Base conversion (hex to dec) ((shell arithmetic expansion)) |
|
| units -t '100m/9.74s' 'miles/hour' | Unit conversion (metric to imperial) |
|
| units -t '500GB' 'GiB' | Unit conversion (SI to IEC prefixes) |
|
| units -t '1 googol' | Definition lookup |
|
| seq 100 | (tr '\n' +; echo 0) | bc | Add a column of numbers. See also add and funcpy |
| calendar | ||
|
| cal -3 | Display a calendar |
|
| cal 9 1752 | Display a calendar for a particular month year |
|
| date -d fri | What date is it this friday. See also day |
|
| date --date='25 Dec' +%A | What day does xmas fall on, this year |
|
| date --date '1970-01-01 UTC 2147483647 seconds' | Convert number of seconds since the epoch to a date |
|
| TZ=':America/Los_Angeles' date | What time is it on West coast of US (use tzselect to find TZ) |
|
| echo "mail -s 'get the train' P@draigBrady.com < /dev/null" | at 17:45 | Email reminder |
|
| echo "DISPLAY=$DISPLAY xmessage cooker" | at "NOW + 30 minutes" | Popup reminder |
| locales | ||
|
| printf "%'d\n" 1234 | Print number with thousands grouping appropriate to locale |
|
| BLOCK_SIZE=\'1 ls -l | get ls to do thousands grouping appropriate to locale |
|
| echo "I live in `locale territory`" | Extract info from locale database |
|
| LANG=en_IE.utf8 locale int_prefix | Lookup locale info for specific country. See also ccodes |
|
| locale | cut -d= -f1 | xargs locale -kc | less | List fields available in locale database |
| recode (Obsoletes iconv, dos2unix, unix2dos) | ||
|
| recode -l | less | Show available conversions (aliases on each line) |
|
| recode windows-1252.. file_to_change.txt | Windows "ansi" to local charset (auto does CRLF conversion) |
|
| recode utf-8/CRLF.. file_to_change.txt | Windows utf8 to local charset |
|
| recode iso-8859-15..utf8 file_to_change.txt | Latin9 (western europe) to utf8 |
|
| recode ../b64 <> file.b64 | Base64 encode |
|
| recode /qp.. <> file.qp | Quoted printable decode |
|
| recode ..HTML <> file.html | Text to HTML |
|
| recode -lf windows-1252 | grep euro | Lookup table of characters |
|
| echo -n 0x80 | recode latin-9/x1..dump | Show what a code represents in latin-9 charmap |
|
| echo -n 0x20AC | recode ucs-2/x2..latin-9/x | Show latin-9 encoding |
|
| echo -n 0x20AC | recode ucs-2/x2..utf-8/x | Show utf-8 encoding |
| CDs | ||
|
| gzip < /dev/cdrom > cdrom.iso.gz | Save copy of data cdrom |
|
| mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz | Create cdrom image from contents of dir |
|
| mount -o loop cdrom.iso /mnt/dir | Mount the cdrom image at /mnt/dir (read only) |
|
| cdrecord -v dev=/dev/cdrom blank=fast | Clear a CDRW |
|
| gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - | Burn cdrom image (use dev=ATAPI -scanbus to confirm dev) |
|
| cdparanoia -B | Rip audio tracks from CD to wav files in current dir |
|
| cdrecord -v dev=/dev/cdrom -audio *.wav | Make audio CD from all wavs in current dir (see also cdrdao) |
|
| oggenc --tracknum='track' track.cdda.wav -o 'track.ogg' | Make ogg file from wav file |
| disk space (See also FSlint) | ||
|
| ls -lSr | Show files by size, biggest last |
|
| du -s * | sort -k1,1rn | head | Show top disk users in current dir. See also dutop |
|
| df -h | Show free space on mounted filesystems |
|
| df -i | Show free inodes on mounted filesystems |
|
| fdisk -l | Show disks partitions sizes and types (run as root) |
|
| rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n | List all packages by installed size (Bytes) on rpm distros |
|
| dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n | List all packages by installed size (KBytes) on deb distros |
|
| dd bs=1 seek=2TB if=/dev/null of=ext3.test | Create a large test file (taking no space). See also truncate |
| monitoring/debugging | ||
|
| tail -f /var/log/messages | Monitor messages in a log file |
|
| strace -c ls >/dev/null | Summarise/profile system calls made by command |
|
| strace -f -e open ls >/dev/null | List system calls made by command |
|
| ltrace -f -e getenv ls >/dev/null | List library calls made by command |
|
| lsof -p $$ | List paths that process id has open |
|
| lsof ~ | List processes that have specified path open |
|
| tcpdump not port 22 | Show network traffic except ssh. See also tcpdump_not_me |
|
| ps -e -o pid,args --forest | List processes in a hierarchy |
|
| ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d' | List processes by % cpu usage |
|
| ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS | List processes by mem usage. See also ps_mem.py |
|
| ps -C firefox-bin -L -o pid,tid,pcpu,state | List all threads for a particular process |
|
| ps -p 1,2 | List info for particular process IDs |
|
| last reboot | Show system reboot history |
|
| free -m | Show amount of (remaining) RAM (-m displays in MB) |
|
| watch -n1 'cat /proc/interrupts' | Watch changeable data continuously |
| system information (see also sysinfo) ('#' means root access is required) | ||
|
| uname -a | Show kernel version and system architecture |
|
| head -n1 /etc/issue | Show name and version of distribution |
|
| cat /proc/partitions | Show all partitions registered on the system |
|
| grep MemTotal /proc/meminfo | Show RAM total seen by the system |
|
| grep "model name" /proc/cpuinfo | Show CPU(s) info |
|
| lspci -tv | Show PCI info |
|
| lsusb -tv | Show USB info |
|
| mount | column -t | List mounted filesystems on the system (and align output) |
| # | dmidecode -q | less | Display SMBIOS/DMI information |
| # | smartctl -A /dev/sda | grep Power_On_Hours | How long has this disk (system) been powered on in total |
| # | hdparm -i /dev/sda | Show info about disk sda |
| # | hdparm -tT /dev/sda | Do a read speed test on disk sda |
| # | badblocks -s /dev/sda | Test for unreadable blocks on disk sda |
| interactive (see also linux keyboard shortcuts) | ||
|
| readline | Line editor used by bash, python, bc, gnuplot, ... |
|
| screen | Virtual terminals with detach capability, ... |
|
| mc | Powerful file manager that can browse rpm, tar, ftp, ssh, ... |
|
| gnuplot | Interactive/scriptable graphing |
|
| links | Web browser |
| miscellaneous | ||
|
| alias hd='od -Ax -tx1z -v' | Handy hexdump. (usage e.g.: hd /proc/self/cmdline | less) |
|
| alias realpath='readlink -f' | Canonicalize path. (usage e.g.: realpath ~/../$USER) |
|
| set | grep $USER | Search current environment |
|
| touch -c -t 0304050607 file | Set file timestamp (YYMMDDhhmm) |
Thanks to :
http://www.freecodeclub.com/art-Linux_advanced_commands.php
Thursday, September 23, 2010
Emacs shorcuts
M-x end copying a region
C-w cut a region
C-M-\ indent-region
Emacs keyboard shortcuts
FILE
Open Ctrl-X, Ctrl-F
Save Ctrl-X, Ctrl-S
Save As Ctrl-X, Ctrl-W
Save All Ctrl-X, S
Revert to File Ctrl-X, Ctrl-V
Revert Buffer Meta-X, revert-buffer
Close Window/Buffer Ctrl-X, K
Quit Ctrl-X, Ctrl-C
EDIT
Undo Ctrl-_
Begin Selection Ctrl-SPC
Cancel Selection Ctrl-G
Cut Selection Ctrl-W
Cut Line Ctrl-K
Paste Ctrl-Y
Copy Selection to Numbered Clipboard Ctrl-X R S [#]
Paste from Numbered Clipboard Ctrl-X R I [#]
Delete DEL
Fwd Delete Ctrl-D
Delete Word Meta-DEL
Fwd Delete Word Meta-D
Delete Line Ctrl-K
CURSOR MOVEMENT
FORWARD BACKWARD
Word Meta-F Meta-B
Line Ctrl-A Ctrl-E
Paragraph Meta-{ Meta-}
Page Ctrl-V Meta-V
Document Meta-<>
C Function Meta-Ctrl-A Meta-Control-E
SEARCH
Incremental Search Ctrl-S
Incremental Search Reverse Ctrl-R
Regexp Inc Search Meta-Ctrl-S
Regexp Inc Search Reverse Meta-Ctrl-R
Interactive Search and Replace Meta-%
Goto Line Number Meta-X goto-line
Previous Matching Bracket Meta-Ctrl-B (or ESC Ctrl-B)
Next Matching Bracket Meta-Ctrl-F (or ESC Ctrl-F)
WINDOW
Close Ctrl-X, K
Next Window Ctrl-X, B
Choose Window Ctrl-X, Ctrl-B
Maximize Ctrl-X, 1
Split Horizontal Ctrl-X, 2
Split Vertical Ctrl-X, 3
Switch Focus Between Windows Ctrl-X, O
Activate Menu Bar Meta-`
REGISTERS
Copy Selection to Numbered Clipboard Ctrl-X R S [#]
Paste from Numbered Clipboard Ctrl-X R I [#]
Set Numbered Bookmark Ctrl-X R SPC [#]
Jump to Numbered Bookmark Ctrl-X R J [#]
FORMATTING
Re-flow Paragraph Meta-Q
Indent Selection Meta-Control-\
Uppercase Word Meta-U
Lowercase Word Meta-L
Capitalize Word Meta-C
Uppercase Selection Ctrl-X, Ctrl-U
Lowercase Selection Ctrl-X, Ctrl-L
MACROS
Start Recording Ctrl-X, (
Stop Recording Ctrl-X, )
Play Macro Ctrl-X, E
Repeat command # times Meta-[#] [command]
Repeat command # times Ctrl-U [#] [command]
Friday, September 10, 2010
How to Write a Batch File
OS used : Windows
Writing a batch file is used to automate daily and often mundane tasks. Instead of typing the same commands day after day, you would simply double click the batch file to run said commands. These instructions will show you how to do so.
For Windows
1.
Open up Notepad in Windows. You can do this by navigating to Start > Programs > Accessories > Notepad, or simply by entering notepad under Start > Run.
2.
Or open up notepad by keying C:\WINDOWS\system32\notepad.exe
3.
Save your file before anything, so be sure to follow the instructions closely.
1. Go to File > Save As... and chose a file name.
2. Choose your desktop as the location to save.
3. Click on the dropdown box "Save as type:" and select "All files" instead of Text (*.txt).
4. Add .bat to the end of your file name before you save. For example, you would type wikihow.bat.
5. Click on Save. If you did this correctly, you should see your file name in the title bar of Windows Notepad. Make sure that it reads as wikihow.bat—not wikihow.bat.txt. Now you are ready to create your batch file.
4.
Type "@echo off" on the first line of your batch file. This will prevent any commands in the batch file to be sent to the screen when executed.
5.
Enter your commands. The following examples show you how to create a batch file that will automatically load wikiHow.com using Internet Explorer.
1.
First example:
1.
o @echo off.
o REM The following will open wikiHow.com in a new Internet Explorer window.
o start iexplore.exe www.sivab.org
or, second example:
1.
o @echo off.
o REM The following will open wikiHow.com in your default browser, if it is IE and you have another IE window open, then it will hijack that window or open a new tab.
o start www.sivab.org
2.
Save the file.
3.
Run the file by double clicking the file on your desktop.
Ex1:
Save the following as “siva.bat” and double click the file.
@echo off
start iexplore.exe www.wikihow.com
Ex2:
Save the following as “siva.bat” and double click the file.
@echo off
start www.wikihow.com
Thanks to :
http://www.wikihow.com/Write-a-Batch-File
Wednesday, July 7, 2010
Command prompts for Windows
Some of these command below can cause harmful an undesirable functions, leading to the formatting of your hard disk and data loss, while others will not run under Windows XP. As for Windows Vista the Run Tab is not visible in the start up menu. Windows Vista specific command prompts are not included. Feel free to add any additional information and tips, you think necessary. Here is a list of commands you can use under Microsoft Windows prearranged depending of their functionality :
Control Panel
Windows utility and applications
Disk management
Connection management
Miscellaneous commands
Control Panel
CONTROL: opens the control panel window
CONTROL ADMINTOOLS: opens the administrative tools
CONTROL KEYBOARD: opens keyboard properties
CONTROL COLOUR: opens display properties.Appearance tab
CONTROL FOLDERS: opens folder options
CONTROL FONTS: opens font policy management
CONTROL INTERNATIONAL or INTL.CPL: opens Regional and Language option
CONTROL MOUSE or MAIN.CPL: opens mouse properties
CONTROL USERPASSWORDS: opens User Accounts editor
CONTROL USERPASSWORDS2 or NETPLWIZ: User account access restrictions
CONTROL PRINTERS: opens faxes and printers available
APPWIZ.CPL: opens Add or Remove programs utility tool
OPTIONALFEATURES: opens Add or Remove Windows component utility
DESK.CPL: opens display properties. Themes tab
HDWWIZ.CPL: opens add hardware wizard
IRPROPS.CPL: infrared utility tool
JOY.CP: opens game controllers settings
MMSYS.CPL: opens Sound and Audio device Properties. Volume tab
SYSDM.CPL: opens System properties
TELEPHON.CPL: Opens phone and Modem options
TIMEDATE.CPL: Date and Time properties
WSCUI.CPL: opens Windows Security Center
ACCESS.CPL: opens Accessibility Options
WUAUCPL.CPL: opens Automatic Updates
POWERCFG.CPL: opens Power Options Properties
AZMAN.MSC: opens authorisation management utility tool
CERTMGR.MSC: opens certificate management tool
COMPMGMT.MSC: opens the Computer management tool
COMEXP.MSC or DCOMCNFG: opens the Computer Services management tool
DEVMGMT.MSC: opens Device Manager
EVENTVWR or EVENTVWR.MSC: opens Event Viewer
FSMGMT.MSC: opens Shared Folders
NAPCLCFG.MSC: NAP Client configuration utility tool
SERVICES.MSC: opens Service manager
TASKSCHD.MSC or CONTROL SCHEDTASKS: opens Schedule Tasks manager
GPEDIT.MSC: opens Group Policy utility tool
LUSRMGR.MSC: opens Local Users and Groups
SECPOL.MSC: opens local security settings
CIADV.MSC: opens indexing service
NTMSMGR.MSC: removable storage manager
NTMSOPRQ.MSC: removable storage operator requests
WMIMGMT.MSC: opens (WMI) Window Management Instrumentation
PERFMON or PERFMON.MSC: opens the Performance monitor
MMC: opens empty Console
MDSCHED: opens memory diagnostics tools
DXDIAG: opens DirectX diagnostics tools
ODBCAD32: opens ODBC Data source Administrator
REGEDIT or REGEDT32: opens Registry Editor
DRWTSN32: opens Dr. Watson
VERIFIER: opens Driver Verifier Manager
CLICONFG: opens SQL Server Client Network Utility
UTILMAN: opens Utility Manager
COLORCPL: opens color management
CREDWIZ: back up and recovery tool for user passwords
MOBSYNC: opens Synchronization center
MSCONFIG: opens System Configuration Utility
SYSEDIT: opens System Configuration Editor (careful while using this command)
SYSKEY: Windows Account Database Security management (careful while using this command)
Windows utility and applications
EPLORER: Opens windows Explorer
IEXPLORER: Opens Internet explorer
WAB: opens Contacts
CHARMAP: opens Character Map
WRITE: opens WordPad
NOTEPAD: opens Notepad
CALC: opens Calculator
CLIPBRD: opens Clipbook Viewer
WINCHAT: opens Microsoft Chat Interface
SOUNDRECORDER: opens sound recording tool
DVDPLAY: run CD or DVD
WMPLAYER: opens Windows Media Player
MOVIEMK: Opens untitled Windows Movie Maker
OSK: opens on-screen Keyboard
MAGNIFY: opens Magnifier
WINCAL: opens Calendar
DIALER: opens phone Dialer
EUDCEDIT: opens Private Character Editor
NDVOL: opens the mixer volume
RSTRUI : opens Tool System Restore (For Vista only)
%WINDIR%\SYSTEM32\RESTORE\rstrui.exe: opens Tool System Restore (for XP only).
MSINFO32: Opens the System Information
MRT : launches the utility removal of malware.
Taskmgr : Opens the Windows Task Manager
CMD: opens a command prompt
MIGWIZ: Opens the tool for transferring files and settings from Windows (Vista only)
Migwiz.exe: Opens the tool for transferring files and settings from Windows (for XP only)
SIDEBAR: Open the Windows (Vista only)
Sigverif : Opens the tool for verification of signatures of files
Winver : Opens the window for your Windows version
FSQUIRT: Bluetooth Transfer Wizard
IExpress opens the wizard for creating self-extracting archives. Tutorial HERE
MBLCTR: opens the mobility center (Windows Vista only)
MSRA : Opens the Windows Remote Assistance
Mstsc : opens the tool connection Remote Desktop
MSDT: opens the diagnostic tools and support Microsoft
WERCON: opens the reporting tool and solutions to problems (for Vista only)
WINDOWSANYTIMEUPGRADE: Enables the upgrade of Windows Vista
WINWORD : opens Word (if installed)
PRINTBRMUI : Opens migration wizard printer (Vista only)
Disk management
DISKMGMT.MSC: opens disk management utility
CLEANMGR: opens disk drive clean up utility
DFRG.MSC: opens disk defragmenter
CHKDSK: complete analysis of disk partition
DISKPART: disk partitioning tool
Connection management
IPCONFIG: list the configuration of IP addresses on your PC (for more information type IPCONFIG/? in the CMD menu)
INETCPL.CPL: opens internet properties
FIREWALL.CPL: opens windows firewall
NETSETUP.CPL: opens network setup wizard
Miscellaneous commands
JAVAWS: View the cover of JAVA software (if installed)
AC3FILTER.CPL: Opens the properties AC3 Filter (if installed)
FIREFOX: Mozilla launches Firefox (if installed)
NETPROJ: allow or not connecting to a network projector (For Vista only)
LOGOFF: closes the current session
SHUTDOWN: shut down Windows
SHUTDOWN-A: to interrupt Windows shutdown
%WINDIR% or %SYSTEMROOT%: opens the Windows installation
%PROGRAMFILES%: Opens the folder where you installed other programs (Program Files)
%USERPROFILE%: opens the profile of the user currently logged
%HOMEDRIVE%: opens the browser on the partition or the operating system is installed
%HOMEPATH%: opens the currently logged user C: \ Documents and Settings \ [username]
%TEMP%: opens the temporary folder
VSP1CLN: deletes the cache for installation of the service pack 1 for Vista
System File Checker (Requires Windows CD if the cache is not available):
SFC / scannow: immediately scans all system files and repairs damaged files
SFC / VERIFYONLY: scans only those files system
SFC / Scanfil = "name and file path": scans the specified file, and repaired if damaged
SFC / VERIFYFILE = "name and file path": Scans only the file specified
SFC / scanonce: scans the system files on the next restart
SFC / REVERT: return the initial configuration (For more information, type SFC /? In the command prompt CMD.
Thanks to :
http://en.kioskea.net/faq/403-command-prompts-for-windows
Remoting into a Windows machine from Ubuntu Linux
Everyone knows the trick where you use a virtual machine with a windows install on it to remote desktop into a remote computer. The problem with this is that you’re putting yet another layer of virtualization between yourself and where you want to be working.
Fortunately, good people like Matthew Chapman over at www.rdesktop.org started working on a way natively remote desktop into a windows box from a linux box.
It’s a command line tool which actually seems to work faster than the native windows remote desktop client. If you’re a stickler for speed but not for graphics this is the way to go.
Say you want to connect to a remote windows machine with an IP of 192.168.100.216 on the GOIT domain with a username of expertuser and a password of ilikewellencryptedpasswords.
You’d then open a terminal and use the following command:
rdesktop -f -uexpertuser -pilikewellencryptedpasswords -dGOIT 192.168.100.216
Most people don’t bother with domains so you can skip that part. The -f is the command to start in full screen mode. Pressing ctrl+alt+enter toggles back and forth between windowed and full screen mode.
If you get a “command not found”, run apt-get, apptitude or some other package manager to install it, then try the command again.
eg.
sudo apt-get install rdesktop
Thanks to : http://www.goitexpert.com/linux/remoting-into-a-windows-machine-from-ubuntu/
If you want to have a Remote Desktop of your Ubuntu Machine from Xp then follw as follows:
Similary For windows :
VNC Viewer Free Edition for Windows is supplied as a component of the VNC Free Edition installation program. If the viewer has been installed in this way then it will be accessible via the Start Menu group created during the installation process (usually RealVNC/VNC Viewer 4).
The viewer executable may also be downloaded, either directly or Zipped. VNC Viewer for Windows is designed to run stand-alone, without requiring any other packages to be installed first.
Monday, June 28, 2010
How to run Control Panel tools by typing a command
To run a Control Panel tool in Windows, type the appropriate command in the Open box or at a command prompt.
NOTE: If you want to run a command from a command prompt, you must do so from the Windows folder. Also, note that your computer may not have all of the tools listed in this article, as your Windows installation may not include all of these components.
Control panel tool Command
-----------------------------------------------------------------
Accessibility Options control access.cpl
Add New Hardware control sysdm.cpl add new hardware
Add/Remove Programs control appwiz.cpl
Date/Time Properties control timedate.cpl
Display Properties control desk.cpl
FindFast control findfast.cpl
Fonts Folder control fonts
Internet Properties control inetcpl.cpl
Joystick Properties control joy.cpl
Keyboard Properties control main.cpl keyboard
Microsoft Exchange control mlcfg32.cpl
(or Windows Messaging)
Microsoft Mail Post Office control wgpocpl.cpl
Modem Properties control modem.cpl
Mouse Properties control main.cpl
Multimedia Properties control mmsys.cpl
Network Properties control netcpl.cpl
NOTE: In Windows NT 4.0, Network
properties is Ncpa.cpl, not Netcpl.cpl
Password Properties control password.cpl
PC Card control main.cpl pc card (PCMCIA)
Power Management (Windows 95) control main.cpl power
Power Management (Windows 98) control powercfg.cpl
Printers Folder control printers
Regional Settings control intl.cpl
Scanners and Cameras control sticpl.cpl
Sound Properties control mmsys.cpl sounds
System Properties control sysdm.cpl
NOTE: The Scanners and Cameras applet (sticpl.cpl) cannot be run in Windows Millennium. It has been replaced by the Scanners and Cameras Folder, which is similar in function to folders like Printers and Dial-up Networking.
Windows substitutes the name of the tool you want to run for %1%. For example:
"rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl".
To run the Users tool in Control Panel, type control Ncpa.cpl users, and then press ENTER.
To run the Users tool for Windows 95/98/Me, type "control inetcpl.cpl users" (without the quotation marks) and then press ENTER.
How to use System Information (MSINFO32) command-line tool switches
You can use the MSINFO32 command-line tool switches to do all of the following:
* Use System Information from a batch file
* Create .nfo or .txt files that contain information from specified categories.
* Open System Information and display only specific categories.
* Save a file silently (without opening System Information).
* Start System Information connected to a remote computer.
* Create a shortcut that opens System Information in a frequently-used configuration.
Note Some command-line switches available for Windows XP are no longer supported in Windows Vista or in Windows 7.
Use the following syntax to run the MSINFO32 command on computers that are running Windows 7, Windows Vista, and Windows XP:
Msinfo32 [/?] [/pch] [/nfo Path] [/report Path] [/computer ComputerName] [/showcategories] [/category categoryID] [/categories categoryID]
Parameters
Path
Specifies the file to be opened in the format C:\folder1\file1.xxx where C is the drive letter, folder1 is the folder, file1 is the file and xxx is the file name extension.
ComputerName
This can be a Universal Naming Convention name, an IP address, or a Fully Qualified Domain Name.
categoryID
This parameter is obtained by using the /showcategories switch.
Command options that are supported in Windows 7, Windows Vista and Windows XP
/nfo {Path}
Saves the exported file as an .nfo file. If the file name that is specified in Path does not end in .nfo, an .nfo file name extension will be appended to the file name.
/report {Path}
Saves the file that is specified in Path in the .txt format. The file name will be saved exactly as it appears in path. The .txt file name extension will not be appended to the file unless it is specified in Path.
/computer {ComputerName}
Starts System Information for the specified remote computer.
Note When you connect to a remote computer, you must have appropriate permissions to access WMI on the remote computer.
Back to the top
Command options that are supported in Windows XP
/pch
Displays the history view.
/showcategories
Starts System Information with the category IDs displayed instead of the friendly names or the localized names. For example, when you use this switch, the Software Environment category is displayed as the SWEnv category. SWEnv is a valid categoryID argument for the /category switch and the /categories switch.
/category {categoryID}
Starts System Information with the specified category selected. Use /showcategories to display a list of available category IDs.
/categories {+categoryID(+categoryID)|+all(-categoryID)}
Starts System Information with only the specified category or categories displayed. It also limits the output to the selected category or categories. Use /showcategories to display a list of available category IDs.
/? Displays a brief summary of MSInfo32 command-line options.
Note Some System Information categories contain large amounts of data. You can use the start /wait command to optimize reporting performance for these categories. For more information, see Related Topics.
Examples
To open System Information in History view, type:
msinfo32 /pch
To create an .nfo file in the folder C:\Temp with a name of Test.nfo, type:
msinfo32 /nfo C:\TEMP\TEST.NFO
To create a .txt file in the folder C:\Temp with a name of Test.txt, type:
msinfo32 /report C:\TEMP\TEST.NFO
To view System Information from a remote computer with a UNC name of BIGSERVER, type:
msinfo32 /computer BIGSERVER
To list the available category IDs, type:
msinfo32 /showcategories
To start System Information with all available information displayed, except Loaded Modules, type:
msinfo32 /categories +all -loadedmodules
To create an .nfo file called SYSSUM.NFO in the C:\Temp folder that contains information in the System Summary category, type:
msinfo32 /nfo C:\TEMP\SYSSUM.NFO /categories +systemsummary
To create a .NFO file called CONFLICTS.NFO in the C:\TEMP folder that contains information about resource conflicts, type:
msinfo32 /nfo C:\TEMP\CONFLICTS.NFO /categories +componentsproblemdevices+resourcesconflicts+resourcesforcedhardware
Thanks to:
http://support.microsoft.com/kb/300887
Thursday, June 24, 2010
Top 10 reasons to learn Wireshark, the open source network analyzer
2. Set yourself apart as a network analyst. It's one thing to be able to configure a TCP/IP network; it's entirely different to understand the inner workings of that network. Consider yourself a true "doctor of networking" with the ability to peer into the communications to pinpoint the cause of problems quickly and accurately. Be prepared for house-call requests. IT professionals are the new "doctor in the family," as you probably already know.
3. Bond with the only source of networking truth -- the packets. The packets never lie. Users do. Salespeople do. Consultants do. You know the drill. You can live in a pure environment of "truth" when you simply watch the hosts communicate with each other and see which one totally messes up the process. (Insert calming relaxation and meditation music here.)
4. Entertain yourself -- network traffic is never boring. From analyzing the yappy traffic from your hyperactive iPhone to the itty bitty stinkin' packets seen during a database operation, there's a lot of hidden "personality" on your network. Take advantage of the fact that it's legal in every country to profile protocols and products. Witness the overbearing protectiveness of network firewalls. Marvel at the blatantly callous disregard that lousy applications have for our precious standards. This is better than Avatar (and your nose won't hurt from those 3D glasses).
5. Find problems before the users do. You can become an IT superstar by identifying problems before the users make those whimpering or demanding calls blaming everything from their PCs to the Internet itself. Proactive analysis can decrease your stress levels in the long run, enabling you to live longer and enjoy your retirement on that small secluded cove by your new beach house.
6. Wireshark is free. Wireshark is considered one of the top open source projects in the world. It costs you nothing to download it from wireshark.org, install it and start your network trace file collection today. This is much better than collecting Star Wars or Star Trek memorabilia (and better for your social life).
7. Get geeky. IT professionals have a deep-seated desire to be geeky -- look at the popularity of the slingshot monkey, for example. Non-IT folks really don't hyperventilate at the chance to win one of those monkeys at a trade show. Heck, they don't even understand the "I will wait in line 10 hours for anything Apple releases" mentality either. (Hmmm… then again, neither do I.) Wireshark lets you see packets in their dissected form or even in hex form (for a special treat on the weekends!).
8. Solve ever-changing puzzles. Extreme Sudoku can be humbling and you've already hit level 80 in World of Warcraft (or higher, with the upcoming expansion pack). Try something new. Try to analyze each packet involved in your login process. It can be solved, and there's a pay-off. You can identify login problems that may occur in the future after you learn the purpose of each packet. Become a modern-day Rubik's-cube-solving kind of freak and impress everyone at the bar (or in that line at the Apple store).
9. Know what's really happening on your network (at home or work). When your kids say they're doing research for homework you can easily sniff the traffic and see which sites they are hitting. Clear text chat traffic offers wonderful parental insight. Don't tell 'em how you know this information -- it's all part of the "eyes in the back of my head" mystery of über-parenting. (Consider blocking their access to wireshark.org to protect your magical mojo.)
10. You don't want to flip burgers for a living. Yup -- learning Wireshark is definitely a big step up from flipping burgers at the local grease pit. You'll run faster, jump higher and even begin counting in binary just for fun. ("OK, little Jimmy… I said stop that… I'm counting… 1…. 0! Time's up!" Hee hee.)
It's never too late to learn network analysis and the true inner workings of your network. Pull up a chair, pour a cup of hot java and settle in for a nice self-improvement session with Wireshark and the Wireshark Network Analysis Book. Together they are the best girlfriends/boyfriends/wives/husbands/lovers/dogs/cats/power tools you've ever had! Enjoy!
Get Wireshark
The current stable release of Wireshark is 1.2.9. It supersedes all previous releases, including all releases of Ethereal. You can also download the latest development release (1.4.0rc1) and documentation.
http://www.wireshark.org/download.htmlThanks to :
http://searchnetworking.techtarget.com/generic/0,295582,sid7_gci1511671,00.html
Saturday, June 12, 2010
How to Format a USB Flash Drive in Ubuntu
- Step 1
Plug your flash drive into an empty USB port, then back up any data on the drive. Open the main menu, move your cursor over "Accessories" and then click on "Terminal." At the terminal prompt, type "sudo apt-get install gparted" (without quotes); then, hit the "Enter" key on your keyboard.
- Step 2
Enter your Ubuntu administrator password when prompted; then hit the "Enter" key again. This will download and install GParted which is an open source drive partitioning program.
- Step 3
Go to the Ubuntu main menu after the installation is complete, move your cursor over "System," then "Administration" and then click on "Partition Editor." Enter your administrator password when prompted; then click "OK."
- Step 4
Click on "GParted" in the toolbar. Then, hover over "Devices" and select your USB flash drive from the list (dev/sdb1, for example). Right-click on the device in the main GParted window; then click "Unmount." It may take a few minutes for the device to be unmounted.
- Step 5
Right-click on the device again (after it is unmounted) and then hover over "Format to." Select the desired file system type (RiserFS, linux-swap, Ext 2/3 or FAT16/32, for example); then click "Apply" in the toolbar. Depending on the size of the flash drive, it will take three to four minutes or so for GParted to complete the process.
- Step 6
Close GParted after the flash drive is formatted. To mount your USB flash drive, unplug it and then plug it back in. The drive is now ready to store data in the file format you selected.
http://www.ehow.com/how_4963426_format-usb-flash-drive-ubuntu.html
How to Export and Save Your Bookmarks From Firefox
Instructions
- Step 1
Open up a Firefox window.
- Step 2
Click on the "Bookmarks" menu and select "Manage Bookmarks..." In case of Firefox 3.6.2 select "Organize Bookmarks..."
- Step 3
Click on the "File" menu and select "Export" in the window that pops up. In case of Firefox 3.6.2, click on "Import and Backup." Select "Export HTML." A save option will appear.
- Step 4
Give your bookmarks whatever title you like and choose a location to save them in the save window that comes up.
- Step 5
Open this file on any computer with a Web browser and click on the links to go to each bookmark, now that your bookmarks are saved as an HTML file. You can also import them into the bookmarks or favorites menu of another computer.
http://www.ehow.com/how_1000389_export-save-bookmarksexport-save-bookmarksexport-save-bookmarksexport-save-bookmarks.html
Thursday, June 10, 2010
Iptux - An intranet communication tool for Linux
It supports both linux and Windows
It support:
- auto detect other clients in the intranet.
- send message to other clients.
- send file to other clients.
If you need to install it
Just update your apt in your system and then type in terminal as follows
sudo apt-get install iptux
it will get automatically installed.
Or else if you want the source of it get it from the following.
http://packages.ubuntu.com/jaunty/iptux
Tuesday, June 8, 2010
Debian's APT - Top Package Management
APT (Advanced Packaging Tool) is a high-level package management tool used in Debian-based Linux distributions. In this article we review APT in detail.
Introduction
Debians distribution base of the package management process is called dpkg, which stands for Debian PacKaGe. Debian-native applications have the .deb extension and dpkg is used to install, remove and provide information to the deb packages on a Debian-based system. In this manner, dpkg is a low-level utility.
Thus, with the advancement of software distribution processes through on-line repositories, together with complex dependency resolution process requirements, a higher-level tool was needed. One which could deal with downloading the packages from remote locations (on-line repositories) and be user friendly. At this point, the Debian community came up with apt, the abbreviation of Advanced Packaging Tool.
apt
apt is not a single program, but rather the name of the package that contains the necessary set of tools to enable the user to download packages from a repository and install them. With these tools, you can apt-get install application_name to download packages and install from the Internet, you can apt-get update to update the packages on your system, apt-get distro-upgrade to upgrade your distribution to the new release, apt-cache search package_name to search for a specific package in the repositories or apt-get remove package_name to remove a specific package etc.
When you want to install an application with the command apt-get install application_name, you very basically trigger the following events:
- * Make apt search for the package in the repository,
- * If the package is found, check if it is already installed,
- * If not, check the dependencies,
- * Check if any, some, or all of the dependencies are already installed,
- * If not, download the missing dependencies in the order that they will be installed by considering their own set of dependencies,
- * Invoke dpkg in such a way that the dependencies are installed first and the application last.
apt Files and Folders
apt uses many files and folders during operation. The main files and folders are as follows:
* /etc/apt/sources.list: The file that contains the path (and URL) of the repositories,
* /etc/apt/sources.list.d: The folder that contains the files, which contain paths (and URLs) of additional repositories,
* /etc/apt/apt.conf or /etc/apt/apt-file.conf: The file that contains the apt configuration,
* /etc/apt/apt.conf.d: The folder that contains additional apt configuration,
* /etc/apt/preferences: The file that contains apt preferences,
* /var/cache/apt/archives: The folder that contains the files apt has downloaded,
* /var/cache/apt/apt-file: The folder that contains the files which maps each file available in the Ubuntu Linux system to the package from which it originates,
* /var/lib/apt/lists: The folder that contains the state information for each package resource specified in the sources.list file,
* /var/lib/apt/keyring: The folder that holds the GPG keyrings,
* /var/lib/apt/periodic: The folder that holds the “update” and “update successful” stamp files.
apt Front-Ends
As you would expect, there are graphical front ends to apt, saving you from typing and issuing commands. These graphical front ends make the users' lives easier by presenting detailed information about the packages. Here is a list of well-known apt graphical user interfaces:
- * Aptitude: This is a curses-based front end to apt.
- * Synaptic: The most famous Gnome front end to apt, shows packages in groups, lets the user search for packages and can download screenshots.
- * Adept: The add/remove package application. It presents the packages in groups and lets the user see the community popularity of the applications.
- * Kpackage: A KDE front-end to apt. It is very similar to Synaptic with a slightly different view.
Conclusion
apt is one of the most powerful (in my personal opinion THE most powerful) package manager in the Linux world. Although I have never seen an analysis on this, the power of the package management is perhaps the reason why Debian is the distribution that has so many derivatives compared to other Linux distributions. Behind the scenes there are very strict rules for packaging and very strict rules to accept packages to the repositories. The package manager works on top of these rules and does a fantastic job. It's been three years and I haven't seen a broken package or an unresolved dependency.
Thanks to:
http://www.brighthub.com/computing/linux/articles/52300.aspx
Understanding Package Management

Introduction
Ian Murdock, the Debian distribution's founder, describes package management as the single biggest advancement Linux has brought to the industry. To understand package management, we have to understand how software is developed, installed and updated, why package managers are needed and how they fit into the software scene.
Dependency Hell
When software is developed, it is designed to take advantage of other components that are already available. We can use an analogy to build a house - if you own a piece of land and want to build a house, would you first build the factories that produce bricks, windows, doors, glasses, carpets, etc. or would you purchase them from the market? This is the same in building software. Suppose that you are writing a download manager. Rather than writing the download code totally from scratch, you can use the graphical components, dialogs, buttons that have been written in advance and focus yourself on the downloading process, just as you would focus on your house's design rather than producing bricks.
Software works the same way. Developers do not need to reinvent the wheel every time they write a program. For example, what if program A depends on components X, Y, Z to run while component X depends on components U and V, component Y depends on components S and T to run, and component U depends on component T to run? The following diagram shows how the components would depend on one another.
o install program A properly, you have to install T first, then U and V, then S, then X, Y and Z and finally A. This is the only way that each component's dependencies would be satisfied. Unless this is the case, the program will produce an error and will not be installed correctly. This is what causes "dependency hell". Don't think dependency hell is a Linux-only concept: it is called “Dependency Hell” in the Linux/UNIX world, “DLL Hell” in the Windows world and “Jar Hell” in the Java World.
Package Management
Wouldn't it be nice if there was a process or program that would allow you to select which program you want to install and then automate the dependency resolution? This is what package management is--a tool to resolve dependencies, install them, install the program, configure and update it. You search for the software, click to install and then let the package manager do the rest. Once you get used to it, a package manager an indispensable piece of software that lets you manage all the applications on your computer, including the operating system.
The packages, their dependencies and other related information are hosted on servers on the Internet, called repositories (or repos for short). For the sake of simplicity, you can think a repository as a pool of programs that can be reached and downloaded by a specific package manager.
Package Manager's Jobs
As we have seen in the previous section, the package manager resolves dependencies and installs the program without any interception from the user. This is not the only thing a package manager does. It also performs the following jobs behind the scenes:
* Verify the file integrity to ensure that the downloaded package is not corrupt and is complete
* Verify the package signature to ensure that it is downloaded from a trusted repository
* Use file archivers to open the downloaded files
* Upgrade software packages from the repositories
* Group packages and present to the user in a simple, structured way (such as Games, Productivity Applications, Internet Applications, etc.)
* Resolve dependencies and make sure that the program the user requests is installed with all dependencies satisfied and in correct working state.
Main distributions have their own package managers, which we will analyze in the oncoming articles (for a quick introduction to installing and uninstalling applications in Linux, you can check our Using Applications in Linux article).
Conclusion
As we have stated in the beginning, package management, one of the biggest advancements in the computer industry, is an excellent way to manage software. Windows, unfortunately, has no way of a central software management except the updates. However, it is your duty as a user to watch for the updates if the program does not inform you about the updates automatically. Even if you are notified, you have to go to the manufacturer's website, download the updated program and install it. In Linux world, you just press “Install updates” when you are informed that there are updates available for your system.
Thanks to :
http://www.brighthub.com/computing/linux/articles/52282.aspx
Running QTP tests using Python
QTP provides an interface called the automation object model. This model is essentially a COM interface providing a bunch of objects that can be used to automate QTP. The full object list is available in the QuickTest Professional Automation documentation.
Running QTP tests from the command line is useful for doing scheduled automatic testing. If you use a continuous integration system to do automatic builds of your software, you can run your QTP tests on the latest build.
The following is a Python script that is able to run a test and print out Passed or Failed. It is a direct port of example code in the documentation written in VBScript
-------------------------------
- import win32com, win32com.client
- qtp = win32com.client.Dispatch("QuickTest.Application")
- # starts up QTP
- qtp.Launch()
- # make the QTP window visible
- qtp.Visible = True
- # Open a test, replace the path
- qtp.Open("C:\Tests\test1")
- # to open a QTP test in Quality Center
- # qtp.Open(r"[QualityCenter] Subject\FolderName\QTPScript")
- # create a RunResultsOptions object
- qtResultsOpt = win32com.client.Dispatch("QuickTest.RunResultsOptions")
- # set the location to where the results will be save
- qtResultsOpt.ResultsLocation = "C:\Test\test1\res"
- qtp.Test.Run(qtResultsOpt)
- print "Test has %s" %qtp.Test.LastRunResults.Status
- # close the Test
- qtp.Test.Close()
- # quit QTP
- qtp.Quit()
Thanks to :
http://bulkan-evcimen.com/running_qtp_test_using_python/
Tuesday, June 1, 2010
Internet Slang Words and Computer Slang
There are many such internet slang words in use, some are more widely understood than others, and new ones are evolving all the time. This list is large but inevitably incomplete; however it contains the more commonly used slang words and slang terms. 4834 acronyms are listed at present - if you know of another that should be here then please add an acronym.
Note that a few of the internet abbreviations stand for phrases containing words that may be offensive to some people. In those cases we have substituted asterisks, or similar, for the internet slang words in question.
For eg :
LOL Laughing Out Loud
Thanks to :
http://www.internetslang.com/