Searchin using find command

June 28, 2008

Good Tutorial for find command’s exercise.

http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Find_command_0

http://www.linux.ie/newusers/beginners-linux-guide/find.php


How to resolve “mv: Argument list too long”

June 27, 2008

I have 1,30,000 files to move from one directory to another, When I ran command

# mv *.txt test

Oh!! There is an error

mv: Argument list too long.

What to do? I did it but in different way. I ran command

#find . -maxdepth 1 -name ‘*.txt’ -exec mv ‘{}’ test \;

Here

.                      defines search directory

-maxdepth     disables recursive search and searches only in the current directory. It allows you to control

how deep into sub directories it will recurs. With ‘-maxdepth’ 1 it will only search in current

directory.

-name             string to be searched

-exec              Applies a command to set of file that has been searched

{}                      Inserts each found file into given command after -exec

\;                     Indicates the exec command line has ended

The above example searches for *.txt files in current directory and moves it to the test directory.

More:    http://www.athabascau.ca/html/depts/compserv/webunit/HOWTO/find.htm


Setup proxy setting in a text based linux machine

June 24, 2008

Reference:

http://kryptoz.wordpress.com/2007/09/19/the-http_proxy-environment-variable-setup-proxy-setting-in-a-linux-machine/

If you need to use proxy server to access http/https from a linux machine in the office LAN, set the environment variable http_proxy. This will allow wget and python’s urllib modules and other applications (yum, apt-get etc) to use this environment variable and access http/https using the settings assigned to the variable http_proxy.

The below would be the ideal way of assigning values for http_proxy variable.

$export http_proxy=”http://<proxy-server-ip>:<port>”

I have added this to my ~/.bashrc so that I don’t have to export this variable every time I reboot my machine !

And then there is the “ftp_proxy” …..


Single-User Mode Require Authentication

June 20, 2008

By default on Red Hat Linux, user can enter single user mode simply by typing “linux single” at the GRUB boot-editing menu. Some believe that this is left in to ease support of users with lost root passwords. In any case, it represents a clear security risk – authentication should always be required for root level access. It should be noted that it is extremely difficult to prevent compromise by any attacker who has knowledge, tools, and full physical access to a system. This kind of measure simply increases the difficulty of compromise by requiring more of each of these factors. These last two items have attempted to address concerns of physical/boot security. To make these preparations more complete, one should consider setting the BIOS to boot only from the main hard disk and locking this setting with a BIOS password.

To set authentication for Single user mode edit /etc/inittab and add following line below initdefault.

id:3:initdefault

~~:S:wait:/sbin/sulogin

This will restrict Single User mode without authentication.