linux poison RSS
linux poison Email
3

Download entire website using Wget for offline viewing on Linux

GNU Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.  This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.  By contrast, most of the Web browsers require constant user's presence, which can be a  great hindrance when transferring a lot of data.

Wget can follow links in HTML and XHTML pages and create local versions of remote web sites, fully recreating the directory structure of the original site.  This is sometimes referred to as "recursive downloading."  While doing that, Wget respects the Robot Exclusion Standard (robots.txt).  Wget can be instructed to convert the links in downloaded HTML files to the local files for offline viewing.

Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved.  If the server supports regetting, it will instruct the server to continue the download from where it left off.

Most of the Linux distribution comes with Wget installed, so you don't have to do anything to install Wget

Using Wget to download entire website:
Create directory where you are planing to store the website content: mkdir /home/nikesh/linuxpoison
use following command to download the website:
wget -r -Nc -mk http://linuxpoison.blogspot.com/
-r  Turn on recursive retrieving
-N  Turn on time-stamping
-m  Create a mirror
-k  Convert the link

After completion all content will get downloaded into your directory for  offline viewing.
Read more
3

Bash Script: Script to check internet connection

Below is simple bash script to test the Internet connection using wget utility.
Feel free to copy and use this script

Source: cat internet_connection.sh
#!/bin/bash

HOST=$1
WGET="/usr/bin/wget"

$WGET -q --tries=10 --timeout=5 $HOST
RESULT=$?

if [[ $RESULT -eq 0 ]]; then
        echo "Connection made successfully to $HOST"
else
        echo "Fail to make connection to $HOST"
fi

Output:
./internet_connection.sh http://yahoo.com
Connection made successfully to http://yahoo.com

./internet_connection.sh http://yahosssss.com
Fail to make connection to http://yahosssss.com


Read more
0

HowTo Install Latest Version of Wine on Ubuntu Linux

Wine is a translation layer (a program loader) capable of running Windows applications on Linux and other POSIX compatible operating systems. Windows programs running in Wine act as native programs would, running without the performance or memory usage penalties of an emulator, with a similar look and feel to other applications on your desktop.

Wine benefits

    * Wine makes it possible to take advantage of all the Unix strong points (stability, flexibility, remote administration) while still using the Windows applications you depend on.
    * Unix has always made it possible to write powerful scripts. Wine makes it possible to call Windows applications from scripts that can also leverage the Unix environment to its full extent.
    * Wine makes it possible to access Windows applications remotely.
    * Wine makes it economical to use thin clients: simply install Wine on a Linux server, and voila, you can access these Windows applications from any X terminal.
    * Wine can also be used to make existing Windows applications available on the Web by using VNC and its Java client.
    * Wine is Open Source Software, so you can extend it to suit your needs or have one of many companies do it for you.

Wine Installation on Ubuntu:
First, open a terminal window (Applications Accessories Terminal). Then add the repository's key to your system's list of trusted APT keys by copy and pasting the following into your terminal:

wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

Next, add the repository to your system's list of APT sources:

For Ubuntu Jaunty (9.04):
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/jaunty.list -O /etc/apt/sources.list.d/winehq.list

For Ubuntu Intrepid (8.10):
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/winehq.list

For Ubuntu Hardy (8.04):
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list

Then update APT's package information by running 'sudo apt-get update'. You can now install Wine normally or by typing 'sudo apt-get install wine' into the terminal.
Read more
0

Easy Administration of Ubuntu Linux using Ubuntu Control Center - Ubuntu 10.10 (Maverick Meerkat)

Ubuntu Control Center or UCC is an application inspired by the Mandriva Control Center that aims to centralize and organize in a simple and intuitive configuration of the main tools of the Ubuntu Linux distribution. UCC uses all the native applications on Ubuntu, but also makes use of third party applications as Hardinfo, Boot-up Manager, Gufw, Startup-Manager, jstest-gtk and Font-manager and the brand new VGA-switcher that uses the module vga-switchero kernel 2.6.35.

Ubuntu Control Center is an excellent application for those who want to centralize various options and settings of Ubuntu in one place, in which items are grouped according to categories, this application can be used by any user without problems.

Read more
0

How to play Encrypted DVDs on Ubuntu Linux

To play encrypted DVDs, the libdvdcss2 package is essential. libdvdcss2 is a simple library designed for accessing DVDs like a block device without having to bother about the decryption. More information about this package can be found at VideoLAN.

You can install libdvdcss2 as a 64-bit .deb package without installing the Medibuntu repositories:
$ wget -c http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.10-0.2medibuntu1_amd64.deb
$sudo dpkg -i libdvdcss2_1.2.10-0.2medibuntu1_amd64.deb
32-bit .deb package:
$ wget -c http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.10-0.2medibuntu1_i386.deb
$ sudo dpkg -i libdvdcss2_1.2.10-0.2medibuntu1_i386.deb
You can also use guidelines provided at Medibuntu. This will install the Medibuntu repositories on your system and then install the libdvdcss2 package:
$ sudo wget http://www.medibuntu.org/sources.list.d/jaunty.list --output-document=/etc/apt/sources.list.d/medibuntu.list
$ sudo apt-get update
$ sudo apt-get install medibuntu-keyring
$ sudo apt-get update
$ sudo apt-get install libdvdcss2
You can also install 32 bit or 64 bit Windows multimedia codecs (if you haven't already done so using ubuntu-restricted-extras):

$ sudo apt-get install w32codecs
    or
$ sudo apt-get install w64codecs

Instead of downloading directly from Medibuntu, you could also use the script included with the libdvdread4 package to download and install libdvdcss2:
$ sudo apt-get install libdvdread4
$ sudo /usr/share/doc/libdvdread4/install-css.sh
Read more
0

How To play encrypted DVDs on Ubuntu

To play encrypted DVDs, the libdvdcss2 package is essential. libdvdcss2 is a simple library designed for accessing DVDs like a block device without having to bother about the decryption. More information about this package can be found at VideoLAN.

You can install libdvdcss2 as a 64-bit .deb package without installing the Medibuntu repositories:
wget -c http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.10-0.2medibuntu1_amd64.deb
sudo dpkg -i libdvdcss2_1.2.10-0.2medibuntu1_amd64.deb
or a 32-bit .deb package:
wget -c http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.10-0.2medibuntu1_i386.deb
sudo dpkg -i libdvdcss2_1.2.10-0.2medibuntu1_i386.deb
You can also use guidelines provided at Medibuntu. This will install the Medibuntu repositories on your system and then install the libdvdcss2 package:
sudo wget http://www.medibuntu.org/sources.list.d/karmic.list --output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get update
sudo apt-get install medibuntu-keyring
sudo apt-get update
sudo apt-get install libdvdcss2
You can also install 32 bit or 64 bit Windows multimedia codecs (if you haven't already done so using ubuntu-restricted-extras):
sudo apt-get install w32codecs or  sudo apt-get install w64codecs
Instead of downloading directly from Medibuntu, you could also use the script included with the libdvdread4 package to download and install libdvdcss2:
sudo apt-get install libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh
Read more
0

Howto Install Wine in Ubuntu

Add the winehq repository : Open up a terminal Applications->Accessories->Terminal
Add the gpg apt key: wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

Add the Repository via wget:
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list


Update the apt sources and install the latest wine!

sudo apt-get update ; sudo apt-get install wine

Done, now you have the latest wine package installed!
Read more
3

How to protect your server from DDos Attack

What is DDos attack:
On the Internet, a distributed denial-of-service (DDoS) attack is one in which a multitude of compromised systems attack a single target, thereby causing denial of service for users of the targeted system. The flood of incoming messages to the target system essentially forces it to shut down, thereby denying service to the system to legitimate users.

There is a perl script which prevent this:
First do the Installation of a simple perl script:

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Uninstalling:
wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos

When you run this Perl script, it will then run an netstat command check how many times each IP is connected and if there are more then the number of connections you specified then it will automatically run a command in APF for the IP to be banned.


Read more
4

Install MS True Type Fonts in Fedora

Microsoft's True Type fonts can also be used on Linux. Not only can they improve visibility, they are essential for proper look and layout. The installation is very simple…


1) Make sure you have the following rpm-packages installed in your distribution. Any version should do.
rpm-build
wget
ttmkfdir utility
cabextract utility


2) # sudo yum install rpm-build cabextract

3) # wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

4) # rpmbuild -bb msttcorefonts-2.0-1.spec

5) Note the path where the rpm is written and use it in the command below.
# rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

6) Restart the windows manager by pressing Ctrl-Alt-Backspace.

Enjoy your new high quality fonts. To verify that the installation succeeded, please use the command 'xlsfonts | grep ^-microsoft'. You should see a whole lot of microsoft font names there. Please note that you need to restart all programs that you want to make aware of the new fonts.
Read more
1

Installation and Configuration of VMWare on Ubuntu Interpid (8.10)

1 - First, obtain a license from VMware here

2 - Install the following packages
apt-get install linux-source-2.6.27 linux-libc-dev xinetd

3 - Then, download VMware
wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.8-126538.tar.gz
Untar: tar -xvzf VMware-server-1.0.8-126538.tar.gz
cd vmware-server-distrib/

4 - Run the installer
./vmware-install.pl
-> Answer yes to each question until it (run the configure script), to which reply "No"

5 - Now, it is necessary to download the patch in order to build the kernel module (Tested with 2.6.27-7-generic)
wget http://www.insecure.ws/warehouse/vmware-update-2.6.27-5.5.7-2.tar.gz
tar -xvzf vmware-update-2.6.27-5.5.7-2.tar.gz
cd vmware-update-2.6.27-5.5.7-2
./runme.pl

-> Answer yes to all questions and press ENTER to use the default settings.

6 - Check whether the service is running

/etc/init.d/vmware status
Bridged networking on /dev/vmnet0 is running
Host-only networking on /dev/vmnet1 is running
Host-only networking on /dev/vmnet8 is running
NAT networking on /dev/vmnet8 is running
Module vmmon loaded
Module vmnet loaded
Read more
1

Text To Speech and Translation Application For Ubuntu Linux - Gespeaker

eSpeak is a compact open source software speech synthesizer for English and other languages, for Linux and Windows. eSpeak uses a "formant synthesis" method. This allows many languages to be provided in a small size. The speech is clear, and can be used at high speeds, but is not as natural or smooth as larger synthesizers which are based on human speech recordings.

eSpeak is available as:
 * A command line program (Linux and Windows) to speak text from a file or from stdin.
 * A shared library version for use by other programs.

Gespeaker is a GTK+ front-end for espeak. It allows to play a text in many languages with settings for voice, pitch, volume, speed and word gap. The text played can also be recorded to WAV file.

Gespeaker supports multiple languages, currently English, Italian, French and Spanish. It works well with both Gnome, XFCE, LXDE environments.

Read more
0

MyDNS + MyDNSConfig installation and configuration

MyDNS is a free DNS server for UNIX. It was implemented from scratch and is designed to serve records directly from an SQL database (currently either MySQL or PostgreSQL).

Its primary objectives are stability, security, interoperability, and speed, though not necessarily in that order. MyDNS does not include recursive name service, nor a resolver library. It is primarily designed for organizations with many zones and/or resource records who desire the ability to perform real-time dynamic updates on their DNS data via MySQL.

MyDNS starts and is ready to answer questions immediately, no matter how much DNS data you have in the database. It supports a few frills, including round robin DNS, dynamic load balancing, and outgoing AXFR for non-MyDNS nameservers and is licensed under the GNU General Public License.

Installation:
First make sure you have a working setup of Apache and mysql

Download MyDNSConfig:
# wget http://mesh.dl.sourceforge.net/sourceforge/mydnsconfig/MyDNSConfig-1.1.0.tar.gz
# tar xvfz MyDNSConfig-1.1.0.tar.gz
# cd MyDNSConfig-1.1.0
# mkdir /srv/www/htdocs/mydnsconfig
# cp -rf interface/* /srv/www/htdocs/mydnsconfig

Above "/srv/www/htdocs/" is my web directory


Mysql database setup::
# mysql -u root -p

> CREATE DATABASE mydns;
> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost' IDENTIFIED BY 'mydnspassword';
> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost.localdomain' IDENTIFIED BY 'mydnspassword';
> FLUSH PRIVILEGES;
> quit;

Replace the word mydnspassword in the above commands with a password of your choice.

Install the MyDNSConfig MySQL Database:

# mysql -u root -p mydns < MyDNSConfig-1.1.0/install/mydnsconfig.sql

Edit the MyDNSConfig configuration; please make sure you fill in the correct database settings:
# vi /srv/www/htdocs/mydnsconfig/lib/config.inc.php

$conf["db_type"]        = 'mysql';
$conf["db_host"]        = 'localhost';
$conf["db_database"]        = 'mydns';
$conf["db_user"]        = 'mydns';
$conf["db_password"]        = 'mydnspassword';

Installing MyDNS
# wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
# rpm -ivh mydns-mysql-1.1.0-1.i386.rpm

Open the MyDNS configuration file /etc/mydns.conf, fill in the correct database details, allow zone transfers by setting allow-axfr to yes, enable TCP (allow-tcp = yes), and specify a recursive resolver (i.e., a valid nameserver, e.g. from your ISP; e.g. recursive = 213.191.92.86) so that MyDNS can answer queries for domains that it isn't authoritative for:

# vi /etc/mydns.conf

Finally start the mydns server
# /etc/init.d/mydns start

To log in to the MyDNSConfig interface, open a web browser and enter enter the following URL:

http:///mydnsconfig/

Replace with the IP address of your server.

The default username and password of MyDNSConfig are:

Username: admin
Password: admin
Read more
5

Protection from malware using Squid proxy server

Malware (for "malicious software") is any program or file that is harmful to a computer user. Thus, malware includes computer viruses, worms, Trojan horses, and also spyware, programming that gathers information about a computer user without permission.

Ignoring the threat of malware is one of the most reckless things you can do in today's increasingly hostile computing environment. Malware is malicious code planted on your computer, and it can give the attacker a truly alarming degree of control over your system, network, and data - without your knowledge

Now, you can get complete protection from such malware by using/configuring the Malware Block List with squid so that you, your network and your users are protected.

Visit : http://www.malware.com.br for more information of the Malware Block List

To use the Malware Block List on a Squid proxy to block user access to URLs that contain Malware you need to perform the following simple steps:

* Download the block list:
      wget -O - http://malware.hiperlinks.com.br/cgi/submit?action=list_squid > malware_block_list.txt

* Create an ACL in the main configuration file (squid.conf) pointing to a file which will have the list URLs:
      acl malware_block_list url_regex -i "/etc/squid/malware_block_list.txt"

* Enable the ACL created previously:
      http_access deny malware_block_list
      deny_info http://malware.hiperlinks.com.br/denied.shtml malware_block_list

* Force Squid reconfiguration:
      squid -k reconfigure

To have an up-to-date block list, create a cron job to run every 4 hours, pointing to a script like this: 
      #!/bin/sh
      wget -O - http://malware.hiperlinks.com.br/cgi/submit?action=list_squid > /etc/squid  /malware_block_list.txt
      squid -k reconfigure 

* Testing  time: After reloading the squid, try to visit the following site ("www.uploadhut.com"), you should see something like ..


If you are able to see this page on your browser -- relax, you are now safe from the malware :)


Read more
0

How to block/allow packets sent by specific Operating System with iptables?

There is an iptables module named OSF (passive OS Fingerprinting) that was written by Evgeniy Polyakov. This module allows passively detect OS packet was sent from and perform various netfilter actions based on this match. Packets with SYN bit set are analyzed.

In order to install OSF module, do the following:

1. Download latest release from here, for example as follows:
wget http://tservice.net.ru/~s0mbre/archive/osf/osf-2008_06_14.tar.gz

2. Edit Makefile from unpacked archive in order to set proper path to iptables headers (iptables.h and libiptc/ dir).

3. If your kernel sources can not be accessed via /lib/modules/$(shell uname -r)/build, you have to replace KDIR variable with the correct path to kernel sources.
4. Run make that should build ipt_osf.ko kernel module.
5. Run make lib that will build libipt_osf.so shared library (copy it to where all other iptables shared libs are placed in your distro e.g. /lib/iptables or /lib64/iptables in Fedora).

6. Run make bin that will build userspace applications which allows to load fingerprints and obtain information about matched packets (load, osfd, ucon_osf).

7. Download signatures list:
wget http://www.openbsd.org/cgi-bin/cvsweb/src/etc/pf.os

8. Install kernel module:
insmod ./ipt_osf.ko

9. Load signatures:
./load ./pf.os /proc/sys/net/ipv4/osf

10. Set up iptables rules allowing/disallowing packets generated by certain OS:
iptables -I INPUT -j ACCEPT -p tcp -m osf --genre Linux --log 0 --ttl 2
This example allows traffic from Linux systems and logs packets from other ones:
ipt_osf: Windows [2000:SP3:Windows XP Pro SP1, 2000 SP3]: 11.22.33.55:4024 -> 11.22.33.44:139

BTW, OSF has following options:

* --log
If present, OSF will log determined genres even if they don't match desired one.
0 - log all matched and unknown entries.
1 - only first one.
2 - log all matched entries.
* --ttl
0 - true ip and fingerprint TTL comparison. Works for LAN.
1 - check if ip TTL is less than fingerprint one. Works for global addresses.
2 - do not compare TTL at all. Allows to detect NMAP, but can produce false results.
* --connector
If present, OSF will log all events also through netlink connector(1.0 id).
More about connector can be found in Documentation/connector in kernel source tree.


Read more
0

Install the latest Intel graphics drivers - Intel Linux Graphics Installer

Intel Linux Graphics Installer allows you to easily install the latest graphics drivers for your Intel graphics hardware. This allows you to stay current with the latest enhancements, optimizations, and fixes to ensure the best user experience with your Intel graphics hardware.

Supported Linux Distributions at 1.0
Ubuntu 12.04
Ubuntu 12.10
Fedora 17
Fedora 18

Ubuntu
Ubuntu's packages and repositories are signed with this GPG key.
In order to "trust" the Intel Linux Graphics Installer, you will need to add a key to Ubuntu's software package manager ("apt"). Open a terminal, and execute this line:
Read more
2

HowTo Use/Install F-PROT Antivirus On Ubuntu

Open the terminal, go to your home directory and become root:

cd ~ sudo su

Then download the DEB package (the one whose link you've just copied to the clipboard) like this (using the link from your clipboard):

wget http://files.f-prot.com/files/linux-x86/fp-linux-ws.deb

Install the package like this:

dpkg -i fp-linux-ws.deb

F-PROT is a command line application, Fortunately, http://web.tiscali.it/sharp/xfprot/ provides a GUI for F-PROT (called XFPROT) that we can install as follows:

wget http://web.tiscali.it/sharp/xfprot/xfprot_1.22-1_i386.deb
dpkg -i
xfprot_1.22-1_i386.deb

Now we need to create menu entry for F-PROT

gedit /usr/share/applications/fprot.desktop

[Desktop Entry]
Name=F-Prot
Comment=Anti-Virus Application
Exec=xfprot
Icon=/usr/local/xfprot/icons/antivirus-48x48.png
Terminal=false
Type=Application
Categories=Application;System;


Save the file. You should now find F-PROT under Applications > System Tools > F-Prot:

After you've started F-PROT/XFPROT for the first time, you will be asked to accept the XFPROT license (GPL). Check I agree, don't show this again and click on Ok:

Read more
0

How to compile Linux kernel

You should be root when running any of the below mentioned commands.
First go to the below link and find the latest kernel version. Currently its - linux-2.6.26

Download it using wget
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.gz

And copy it under /usr/src
# cp linux-2.6.26.tar.gz /usr/src

Go to this directory
# cd /usr/src

And extract the kernel from the compressed file. This command will create a new folder called linux-2.6.26
# tar zxf linux-2.6.26.tar.gz

Now go to the directory that contains your new kernel
# cd linux-2.6.26

And get your old configuration
# make oldconfig

If you have qt libraries installed on your system run # make xconfig. This is the graphical configuration system through which you will make all the necessary changes in your kernel. If you have only ncurses installed you may run # make menuconfig
# make xconfig or # make menuconfig

When you have configured everything run make to start compiling your kernel
# make

Then run make modules_install to install your new modules created above.
# make modules_install

And finally create all the necessary files under /boot and also configure grub to include your new kernel
# make install

Reboot and from grub choose the new kernel! If anything goes wrong it means you have made a mistake in the kernel configuration. Boot in with your old kernel and run again make xconfig to do the appropriate changes.
# reboot
Read more
1

Bash Script - Protect your server from DDos (Distributed Denial of Service) Attack

What is DDos attack:
On the Internet, a distributed denial-of-service (DDoS) attack is one in which a multitude of compromised systems attack a single target, thereby causing denial of service for users of the targeted system. The flood of incoming messages to the target system essentially forces it to shut down, thereby denying service to the system to legitimate users.

DDoS-Deflate is a very simple but effective bash script which monitors the numbers of connection made by a particular ip address using 'netstat' command and if the number of connection from a single ip address reaches a particular limit (150 default) it will block that ip address using simple iptables rules for defined time period.

DDoS-Deflate Installation:
Open the terminal and type following command:
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh
After successful installation, you can find the DDoS-Deflate configuration file at: /usr/local/ddos/ddos.config
Read more
0

Usefull 100+ Commands

   1. Schedule a queue to run at 9am on March 1st. Note: Ctrl-d to save and exit.

      $ at 9am March 1

   2. Schedule a queue to run after 5 minutes.

      $ at now +5 minutes

   3. Check any jobs pending to run, same as at -l .

      $ atq

   4. Empty out a file.

      $ cat /dev/null > /path/to/file

   5. Change directory, see also pushd and popd.

      $ cd

   6. List run level information for the service type.

      $ chkconfig --list

   7. Change owner recursively.

      $ chown -R : /path/to/directory

   8. Change shell.

      $ chsh

   9. Scan recursively for viruses.

     $ clamscan -r

  10. Compare two files.

     $ cmp file1 file2

  11. Copy keeping the directory structure.

      $ cp --parent /source/path /destination/path

  12. Copy keeping the permissions of the user.

      $ cp -p

  13. Copy recursive.

      $ cp -r

  14. Copy without shell aliasing.

      $ \cp

  15. List crontab for user.

      $ crontab -u -l

  16. Check current date and time.

      $ date

  17. Set current date and time, may need to set the hardware clock to the system time too, `man hwclock`.

      $ date -s 'Wed May 28 11:35:00 EST 2003'

  18. Show disk free in human readable format.

      $ df -h

  19. Configure interface using DHCP protocol.

      $ dhclient eth0

  20. Find context differences between two files.

      $ diff -c

  21. Creating a patch file.

      $ diff -Naur oldDir/oldFile newDir/newFile > new_patchFile

  22. Kernel buffer

      $ dmesg

  23. Show disk used in human readable format.

      $ du -h /path/to/directory

  24. Find files larger than 10MB.

      $ find /path/to/file -size +10000k

  25. Find file permissions with setuids.

      find / \( -perm -4000 -o -perm -2000 \) -exec ls -ldb {} \;>> /tmp/suids

  26. Search for world writable files and directories.

      $ find / -perm -002

  27. Display information on free and used memory.

      $ free

  28. Grep on word boundaries.

      grep -w

  29. Count the number of mathces - similar to “wc -l”.

      $ grep -c

  30. Perform timings of device reads for benchmark and comparison purposes.

      $ hdparm -t /dev/hda1

  31. Set the hardware clock to the current system time.

      $ hwclock --systohc

  32. check the ip address

      $ ifconfig

  33. Add an  ip address to eth0.

      $ ifconfig eth0:x xxx.xxx.xxx.xxx

  34. Install loadable kernel module. You can also use `modprobe` to do the same.

      $ insmod

  35. Displays information about your system’s CPU and I/O.

      $ iostat [ interval [ count ] ]

  36. List iptables firewall rules in numeric format.

      $ iptables -L -n

  37. HangUP process so it will re-read the config file.

      $ killall -HUP

  38. Install the boot loader and increase verborsity.

      $ lilo -v -v

  39. Query the boot map.

      $ lilo -q

  40. One time boot to the named kernel.

      $ lilo -R

  41. Create symbolic link to the target file or directory.

      $ ln -s

  42. Configure dynamic linker run-time bindings

      $ ldconfig

  43. List the IPs bound via Ensim

      $ listaliases

  44. Quickly search for indexed files. Run `updatedb` to update the indexed database.

      $ locate

  45. List files.

      $ ls

  46. List loaded kernel modules

      $ lsmod

  47. Create the access.db file database map for sendmail.

      $ makemap hash /etc/mail/access.db < /etc/mail/access

  48. Create/Make a new directory.

      $ mkdir

  49. Generate a random 128 character length password.

      $ mkpasswd -l 128

  50. Read in the contents of your mbox (or the specified file).

      $ mail -f /var/mail/nameOfFile

  51. Print the mail queue

      $ mailq

  52.

      $ mailstat /path/to/procmail/log

  53. Description of the hierarchy directory structure of the system

      $ man hier

  54. Check the MD5 message digest.

      $ md5sum

  55. Mount points check.

      $ mount

  56. Provide information about your systems’ processor.

      $ mpstat [ interval [ count ] ]

  57.

      $ ncftpget -R -u  -p
      hostname /local_dir /remote_dir

  58.

      $ netstat -a | grep -i listen

  59. Will show you who is attached to what port.

      $ netstat -anpe

  60.

      $ netstat -n

  61. See which programs are listening on which port

      $ netstat -lnp

  62. Will show you what local TCP ports are open and what programs are running on them.

      $ netstat -lntpe

  63. Will show you what local UDP ports are open and what programs are running on them.

      $ netstat -lnupe

  64. Run a program with modified scheduling priority. (# range between -20 to +20, negative is higher priority)

      $ nice -n # [command to nice]

  65. Scan network

      $ nmap -v hostname/ip

  66. Patch and keep a backup

      $ patch -p# -b < patch_file

  67.

      $ ps -ecaux

  68. Turn off all quotas for users and groups, verbose mode

      $ quotaoff -augv

  69. Check quota for all users and groups interactively, do quotaoff first.

      $ quotacheck -augmiv

  70. Turn on all quotas for users and groups

      $ quotaon -augv

  71. Add host ip to route on a particular device.

      $ route add -host xxx.xxx.xxx.xxx dev eth0:x

  72.

      $ rdate

  73. Remove file

      $ rm

  74. Remove kernel module

      $ rmmod

  75. Display the routing table in numeric.

      $ route -n

  76.

      $ rpm

  77. Uninstall/erase package.

      $ rpm -e

  78. Erase without dependency check.

      $ rpm -e --nodeps

  79. List out installed rpms by date, latest on top.

      $ rpm -qa --last | less

  80. Rebuild rpm database.

      $ rpm --rebuilddb

  81. Find which package owns the file.

      $ rpm -qf /path/to/file
      $ rpm -q --whatprovides /path/to/file

  82. Verify package.

      $ rpm -V

      or

      $ rpm -Vf /path/to/file

  83. Locate documentation for the package that owns the file.

      $ rpm -qdf /path/to/file

  84. Query information on package.

      $ rpm -qip

  85. Query files installed by package.

      $ rpm -qlp

  86. Gives list of files that will be installed/overwritten.

      $ rpm -ql

  87. Will show the scripts that will be executed.

      $ rpm -q --scripts

  88. Display system activity information

      $ sar

  89. Print a 0 padded sequence of numbers.

      $ seq -w 1 10

  90. Record eveything printed on your terminal screen.

      $ script -a

      Ctrl+D to exit out. `more ` to view.


  91. Check the status of a service.

      $ service status

  92. Restart after shutdown and force fsck (fsck may take a while).

      $ shutdown -rF now

  93. Split a file into pieces with numeric suffixes, so it can be burnt to cds.

      $ split -d -b 640k big_input_filename.gz piece_file_prefix.gz.

      To piece it back you can `cat piece_file_prefix.gz.* > original.gz`
  94. Determine if a network service binary is linked againt tcp wrapper, libwrap.a

      $ strings -f | grep hosts_access

  96. how to use tar

      $ tar -cvzf fileName.tar.gz `find /file/path -mtime -1 ! -type d -print`

  97.

      $ tar -xvzpf fileName.tar.gz /path/to/file.txt

  98. How to use tcpdump

      $ tcpdump -i eth0 dst port 80 | more

  99. System process status

      $ top

 100. View the full command line.

      $ top -c

 101. Create empty file of 0 byte

      $ touch

 102. Similar to `which` - shows full path to the command.

      $ type

 103. Check the limit of user

      $ ulimit -a

 104. Check the version of kernel running

      $ uname -a

 105. Update package profile with rhn

      $ up2date -p

 106. Install package via up2date.

      $ up2date -i

 107.

      $ uptime

 108.

      $ usermod

 109. Utility reports virtual memory statistics

      $ vmstat [second interval] [no. of count]

 110. Show who is logged on and what they are doing.

      $ w

 111. Periodically watch output of a command in full screen

      $ watch ''

 112. Run and generate the apache reports using webalizer

      $ webalizer -c /path/to/webalizer.conf

 113. Recursive download of a url, converting links, no parent.

      $ wget -r -k -np

 114. Mirror, convert links, backup original, dynamic to html and output a “logFile”.

      $ wget -m -k -K -E -o [logFile]

 115. Locate the binary, source, and manual page files for a command.

      $ whereis

 116. Shows the full path of command.

      $ which

 117. Show who is logged on.

      $ who

 118. Yum package updates

      $ yum check-update           -- check to see what updates are needed
      $ yum info     -- show basic information about a package
      $ yum update   -- update particular package

 119. Control jobs:

      $ Ctrl-z   -- suspend foreground job
      $ jobs     -- list jobs
      $ bg       -- send job to background
      $ fg       -- bring job to foreground
Read more
0

Large Text File (logs) viewer - Rowscope

Rowscope is a file viewer for large text files. It can read files larger than 1 GB. It is very fast (a few seconds to examine a 1GB file) and it never blocks.

The idea back Rowscope is that a person cannot read the whole file when it is so large; a person can only read some parts of the file, possibly the ones that contain the information he is looking for.
For example when somebody reads the log file produced by an application, he will probably look for a specific error or for the lines produced in a specific period of the day.

With Rowscope the user:
Localizes the part or parts of the file that he wants to read, using search strings or regular expressions.
Then he can expand one of the rows he has found, which means that he makes Rowscope display the rows immediately before or after that row.

The main features of Rowscope are the following:
  * It never blocks the GUI. The user is able to write text and click buttons when Rowscope is loading a file.
  * It does not monopolize the CPU. There are moments in which Rowscope uses some CPU, but it never blocks the other applications.
  * It does not use a large amount of memory. It uses some MBytes of memory, but it never becomes a problem for the operating system or the other applications.
  * It is always able to stop. It is always possible to stop or close Rowscope, also when it is loading/analyzing a file.

Installation:
you need to have java installed in-order to use Rowcopy

wget http://sourceforge.net/projects/rowscope/files/1.0/rowscope_1_0_linux_gtk_32.jar/download
java -jar rowscope_1_0_linux_gtk_32.jar

Above command will install the Rowscope into your home directory


Read more
Related Posts with Thumbnails