Category
cmd
-
07.13.09OR in grep$ egrep "regexp1|regexp2" file1 file2 Search one or more files (file1 and file2 in our example) for lines that match any of several (two in our case) regular expressions: regexp1 OR regexp2. The '|' stands for the OR.
-
07.10.09Adding password protection on a file with vim$ vim -x filename The -x option uses encryption when writing the file. It will ask for a key: Enter encryption key: ****** Enter same key again: ****** From then on your filename will be encrypted and accessed using the password. The -x option will no longer be necessary when editing the file.
-
05.18.09Vi: emptying a file in one shot:1,$d This vi command blanks out the file being edited. Updated: javisantana suggested another way to emptying a file. Type: ggdG in command mode.
-
05.12.09Quick access to the ASCII tableman ascii Prints octal, hexadecimal and decimal listings of the ASCII character set.
-
04.17.09Showing a computer’s open ports$ netstat -an | grep -i listen Shows the open ports on all the IPs of the computer the command is run on.
-
04.12.09Extracting an rpm package without installing it$ rpm2cpio myrpmfile.rpm | cpio -idmv Extracts an rpm package in the current directory without installing it. It is very useful when you only want to see its contents.
-
04.07.09Hearing a beep when your server comes online$ ping -i 60 -a host What do you do when you reboot your server? If you run this command you hear a beep when it comes online. The -i 60 option waits for 60 seconds between pings. The -a option includes an audible bell in the output when a packet is received.
-
04.03.09Pulseaudiopulseaudio -D Launches the pulseaudio daemon for the active session. Try it. Switch to another terminal (Ctrl + Fx) and see what happens if other users are logged in or not.
-
03.31.09RPM: listing the contents of an rpm file$ rpm -qpl kernel-2.6.27.19-170.2.35.fc10.i686.rpm /boot/System.map-2.6.27.19-170.2.35.fc10.i686 /boot/config-2.6.27.19-170.2.35.fc10.i686 /boot/initrd-2.6.27.19-170.2.35.fc10.i686.img /boot/vmlinuz-2.6.27.19-170.2.35.fc10.i686 [...] Lists all the files in an RPM file. Also note that rpm can query remote RPM files through FTP and HTTP.
-
03.26.09Mounting ISO images# mount -o loop file.iso /mnt/iso Mounts an iso image on the /mnt/iso directory. The loopback module needs to be enabled.