Linux Tips and Tricks
Verify md5sum using linux
Create an md5sum using linux
Verify md5sum using windows
To resume a partially download file using wget or curl
To resume a partially download file via ftp with username and password
To get the size of all directories in the current directory:
A spiffy way to see what directories are taking up the most space on your hard drive is du -sk * | sort -n -- this will show just the base-level directories in whatever directory you run this in. So it will include the size of sub-directories, but not list them in the output.
To run a program in the background simply add a & to the end of your command, i.e. top &. If you have already started the program and you now want to run it in the background first suspsend it with CTRL - Z then type bg To get the program back in the foreground simply issue the command fg.
Instead of cd /home/user you can simply cd ~ or cd to quickly get to your home directory. also cd - will return you to your previous directory you were in.
If you untar a package, and it makes a mess of your directory because the packager didn't include the files in his tarball in a directory, you can use rm `tar ftz stupidpackage-1.0.0.tar.gz` to quickly get rid of those cluttering files.
This might sound silly, but for the longest time I didn't know how to examine my system and it's information effectively. issuing df or df -h will show you free and used disk space, procinfo if installed gives you a wealth of information from /proc, and overmore cat/proc/interrupts or cat /proc/cpuinfo gives your irq settings and your cpu information respectively. Play around, /proc holds many more system tid bits if you look.
If you want to mirror via ftp something like the latest RedHat distribution, an easy way is to use Midnight Commander (mc). Type: $ mc and then press F9 and select FTP link . . . and enter a host such as sunsite.unc.edu Move to directory you want to download and select file/directory by Insert-key and press F5 to copy. This may be a nice alternative for people who don't want to use a command line FTP client.
Search for SUID programs to save yourself from getting rooted with find / -perm -4000
Sometimes it is necessary to know which rpm package contains
one or another file. One way to make a catalog of all files from all rpms
of your favorite distribution is:
lsmod is a great way to check out information about your loaded modules.
You can use the smbmount command to mount windows shares
like normal drives. For this you need samba and smbfs support in your
kernel. The syntax is:
While using bash, if you have typed a long command, and then realize you don't want to execute it yet, don't delete it. Simply append a # to the beginning of the line, and then hit enter. Bash will not execute the command, but will store it in history so later you can go back, remove the # from the front, and execute it.
To view the contents of a file that is growing in size (e.g. a log file) use tail +0 -f file. The command tail -0 -f file can be used to create an ersatz or substitute FIFO.
Where has all my disk space gone! start in /home or /var
and run the following:
Sometimes you may want to unzip more than one file simultaneously. Doing unzip * does not work, the correct way to do it is by adding quotes, like this: unzip "*"
In the bash console, hitting ALT-printscreen will switch you immediately to the tty you were last at.
To search the entire hard disk for files containing "pattern"
you can use find:
Type ls -alF | grep /$ for a list of subdirs in the current directory. I have this aliased to 'lsd'
netstat -a will allow you to see all the tcp and udp ports your system has open.
pstree will print out they system's tree of process, so you can see what processes came from what processes.
To look at an RPMs information for both already installed packages and packages for which you have the file for, rpm -qi package_name will do it.
A cool way to get screenshots in X windows is to use the import command. Example: import background.jpg then make a box around what you want with you cursor.
You can use all valid terminals, even if they aren't
being used, by sending your data to the terminal number you want. Example:
tail -f /var/log/messages > /dev/tty12
If you want to run a command and log out while it is running, you nohup. Example: nohup program or nohup %1
To use a text mode other than the default 80x25,
such as 80x50 or even 132x60, put vga=ask into your
lilo.conf file and then run lilo. When you reboot it will let you
choose your video mode. When you decide which one you want, you can put
vga=n where n is the number of the video mode you would like. Usually
n is 1 through 8.
ifconfig eth0 <ipaddress>
lpr -P <printername>
mount -t ramfs ramfs /ramfiles
lftp rm-r /mirror -Rv /localdirectory
ping <ipaddress> -i90 > /dev/null &
192.168.1.10 could be www.xyz.foo.com, and 192.168.2.10
could be ftp.xyz.foo.com .
netmask | x | Subnet
1 kilobyte = 2^10 Bytes = 1024 bytes
1 kilobyte =1024 bytes
vi /etc/apache/conf/httpd.conf (and put and end of file)
Then restart apache and it'll tell you if any errors exist or not
If you don't have apache mod_rewrite loaded then you could use below however it restricts you only allowing you to return a 403 forbidden page.
SetEnvIfNoCase Referer "^http://www.mrbass.org/" local_ref=1