Posts

Showing posts from 2006

rm and the 'Argument list too long'

you wanted to delete all the files in a directory that begins with the word 'temp' bala bala [prabhat@my-site]# rm temp* bash: /bin/rm: Argument list too long ERROR! This happens when you are trying to delete too many files in a directory at the same time - it seems rm has limits .... To solve the problem: Use 'find' to pipe all the matching files to 'rm', one at a time. [prabhat@my-site]# find . -name 'temp*' | xargs rm or [prabhat@my-site]# find . -name 'temp*' - print0 | xargs -0 rm -f

Sort folders by size with one command

Entire user’s data is under /home, I need to have a list of all the sub folders sorted by the size of the sub folders. simple command to get the list of sub folders sorted by their size: du --max-depth=1 /home/ | sort -n -r

Zombie Process

A process can be sleeping in kernel code. Usually that's because of faulty hardware or a badly written driver- or maybe a little of both. A device that isn't set to the interrupt the driver thinks it is can cause this, for example- the driver is waiting for something its never going to get. The process doesn't ignore your signal- it just never gets it. A zombie process doesn't react to signals because it's not really a process at all- it's just what's left over after it died. What's supposed to happen is that its parent process was to issue a "wait()" to collect the information about its exit. If the parent doesn't (programming error or just bad programming), you get a zombie. The zombie will go away if its parent dies- it will be "adopted" by init which will do the wait()- so if you see one hanging about, check its parent; if it is init, it will be gone soon, if not the only recourse is to kill the parent..which you may or may no

grep command : Finds text within a file

The grep command searches for the pattern specified by the Pattern parameter and writes each matching line to standard output. Examples 0. $ grep '12.00' /home/prabhat/backup/log.txt This command basically shows how you can use grep to extract lines containing a particular string from a text file. 1. To use a pattern that contains some of the pattern-matching characters *, ^, ?, [, ], \(, \), \{, and \}, enter: grep "^[a-zA-Z]" pgm.s This displays every line in pgm.s whose first character is a letter. 2. To display all lines that do not match a pattern, enter: grep -v "^#" pgm.s This displays every line in pgm.s whose first character is not a # (pound sign). 3. To display all lines in the file1 file that match either the abc or xyz string, enter: grep -E "abc|xyz" file1 4. To search for a $ (dollar sign) in the file named test2, enter: grep \\$ test2 The \\ (double backslash) charac

yum : Yellow dog Updater, Modified

automated software installation and update for linux yum is software installation tool for Red hat linux and Fedora Linux. It is a complete software management system. yum is designed to use over network/internet. It does not use CDROM to install packages. If you are using fedora you don't have to install it, it is part of fedora itself. In the case u don't have yum, then u can download yum from project home page http://linux.duke.edu/projects/yum/download.ptml u can Install using.(it is avaliable in rmp) # rpm -ivh yup* U can Configure yum editing /etc/yum.conf # emacs /etc/yum.conf Append or edit code as follows: [base] name=Fedora Core $releasever - $basearch - Base baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag baseurl=http://mirrors.kernel.org/fedora/core/$releasever/$basearch/os Install GPG signature key with rpm command: # rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt and other keys too (if any using above command) Update your package lis

Did u know how many virtual web site's ?

Following command show how many virtual web site's running on ur server. httpd -t -D DUMP_VHOSTS or apache2 -t -D DUMP_VHOSTS

How to keep a computer from answering to ping?

it is possible to block pings entirely to your machine.. a simple "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all" will do the trick... to turn it back on, simply "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"

How to do backup with tar?

You can mantain a list of files that you with to backup into a file and tar it when you wish. tar czvf tarfile.tar.gz -T list_file where list_file is a simple list of what you want to include into the tar i.e: /etc/smb.conf /root/myfile /etc/ppp (all files into the /etc/ppp directory) /opt/gnome/html/gnome-dev-info.html

How to remove a file with a dash as first character?

If you accidentally created a file with a - in the beginning then you want to remove it, you have to do : rm ./-thefile

Secure Deletion of Data from Magnetic and Solid-State Memory

Secure Deletion of Data from Magnetic and Solid-State Memory `shred': Remove files more securely `shred' overwrites devices or files, to help prevent even very expensive hardware from recovering the data. Ordinarily when you remove a file (*note rm invocation::), the data is not actually destroyed. Only the index listing where the file is stored is destroyed, and the storage is made available for reuse. There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused. On a busy system with a nearly-full drive, space can get reused in a few seconds. But there is no way to know for sure. If you have sensitive data, you may want to be sure that recovery is not possible by actually overwriting the file with non-sensitive data. The best way to remove something irretrievably is to destroy the media it's on with acid, melt it down, or the like. For cheap removable media like floppy disks, this is the preferred

Danger of 'Ctrl+C' on the Web

We do copy various data by ctrl+c for pasting elsewhere. This copied data is stored in clipboard and is accessible from the net by a combination of Javascripts and ASP. Just try this: 1) Copy any text by 'ctrl+c' 2) Click the Link: www.sourcecodesworld.com/special/clipboard.asp You will see the text you copied on the Screen which was accessed by this web page. (Check it out !!) Do not keep sensitive data (like passwords, reditcard numbers, PIN etc.) in the clipboard while surfing the web. It is extremely easy to extract the text stored in the clipboard to steal your sensitive information. Be cautious ... To avoid Clipboard Hack Problem, do the following: 1) In Internet Explorer, Go to Tools -> Internet options -> Security 2) Press Custom level. 3) In the security settings, select disable under Allow paste operations via script and click on 'OK. (Now the contents of your clipboard are safe.) It doesn't work on firefox. Happy Surfing......

Recover from rm

In order to undelete a file, you must know the following things: • On which device your file was stored • What kind of file system was used (eg. ext2, reiserFS, vfat) To find it out, type 'mount | column -t' Or echo "DEVICE DIRECTORY FS-TYPE" > tmp; mount | cut -d" " -f1,3,5 | sort >> tmp; cat tmp | column -t | sed -e "1s/.*/`tput smso`&`tput rmso`/" The output should be something like this: bash$ mount | column -t /dev/hda5 on / type ext2 (rw) proc on /proc type proc (rw) usbdevfs on /proc/bus/usb type usbdevfs (rw) devpts on /dev/pts type devpts (rw) /dev/hda1 on /mnt/windows/C type vfat (rw,noexec,nosuid,nodev) /dev/hda6 on /mnt/windows/E type vfat (rw,noexec,nosuid,nodev) /dev/hdc5 on /mnt/oldwin type vfat (rw,noexec,nosuid,nodev) Now, of which (printed) directory was the directory of your deleted file a subdirectory? E.g. if your file

Proxy server types and uses for HTTP Server

Proxy server In an enterprise that uses the Internet, a proxy server is a server that acts as an intermediary between a workstation user and the Internet so that the enterprise can ensure security, administrative control, and caching service. A proxy server is associated with or part of a gateway server that separates the enterprise network from the outside network and a firewall server that protects the enterprise network from outside intrusion. Proxy servers receive requests intended for other servers and then act to fulfill, forward, redirect, or reject the requests. Exactly which service is carried out for a particular request is based on a number of factors which include: the proxy server's capabilities, what is requested, information contained in the request, where the request came from, the intended destination, and in some cases, who sent the request. An advantage of a proxy server is that its cache can serve all users. If one or more Internet sites are frequently requested

Some administration commands

cat /var/log/secure (as root) Inspect the important system log. It is really a good idea to do it from time to time if you use Internet access. watch -n 60 my_command Execute my_command repeatedly at 60-second intervals (the default interval is 2 seconds). more u can access. http://linux.about.com/od/linux101/l/blnewbie5_12.htm

Admin Unix

This blog for System Administrator of UNIX/LINUX. This wll help u in Technical and Non- Technical Aspect.