Spiga

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

How To Resolve Argument Too Long Error In Unix

How To Resolve Argument Too Long Error In Unix

Sometime, when we fire some commands in the unix, then it gives the 'Argument Too Long Error' on the console. We get this error when there is lots of file, suppose there are 15k files and we want to move those file or delete those files, then it gives the same error.

How To Resolve:

To resolve these error, we will use the find commands and will pass the remove command as a argument to the find command.

find . -name '*.*' xargs rm

.           : is directory name
-name  : is type of file that we want to delete.
xargs    : is Linux command that makes passing a number of arguments to a command easier.

Hope, this will solve your problem.

Basic Linux VI Command

Basic Linux VI Command


Moving the Cursor

*j or
[or down-arrow]
move cursor down one line
*k [or up-arrow]move cursor up one line
*h or
[or left-arrow]
move cursor left one character
*l or
[or right-arrow]
move cursor right one character
*0 (zero)move cursor to start of current line (the one with the cursor)
*$move cursor to end of current line
wmove cursor to beginning of next word
bmove cursor back to beginning of preceding word
:0 or 1Gmove cursor to first line in file
:n or nGmove cursor to line n
:$ or Gmove cursor to last line in file

Adding, Changing, and Deleting Text

*u UNDO WHATEVER YOU JUST DID;
*iinsert text before cursor, until hit
Iinsert text at beginning of current line, until hit
*aappend text after cursor, until hit
Aappend text to end of current line, until hit
*oopen and put text in a new line below current line, until hit
*Oopen and put text in a new line above current line, until hit
*rreplace single character under cursor (no needed)
Rreplace characters, starting with current cursor position, until hit
cwchange the current word with new text,
starting with the character under cursor, until hit
cNwchange N words beginning with character under cursor, until hit;
e.g., c5w changes 5 words
Cchange (replace) the characters in the current line, until hit
ccchange (replace) the entire current line, stopping when is hit
Ncc or cNcchange (replace) the next N lines, starting with the current line,
stopping when is hit
*xdelete single character under cursor
Nxdelete N characters, starting with character under cursor
dwdelete the single word beginning with character under cursor
dNwdelete N words beginning with character under cursor;
e.g., d5w deletes 5 words
Ddelete the remainder of the line, starting with current cursor position
*dddelete entire current line
Ndd or dNddelete N lines, beginning with the current line;
e.g., 5dd deletes 5 lines
yycopy (yank, cut) the current line into the buffer
Nyy or yNycopy (yank, cut) the next N lines, including the current line, into the buffer
pput (paste) the line(s) in the buffer into the text after the current line

Linux Basics

Unused Linux Basics

Shellscript File Tests

if [ -e $file ]; then
./myUtil $file
fi

TEST MEANING
[ -b $file ] True if file exists and is block special.
[ -c $file ] True if file exists and is character special.
[ -d $file ] True if file exists and is a directory.
[ -e $file ] True if file exists.
[ -f $file ] True if file exists and is a regular file.
[ -g $file ] True if file exists and is set-group-id.
[ -k $file ] True if file has its ``sticky'' bit set.
[ -L $file ] True if file exists and is a symbolic link.
[ -p $file ] True if file exists and is a named pipe.
[ -r $file ] True if file exists and is readable.
[ -s $file ] True if file exists and has a size greater than zero.
[ -S $file ] True if file exists and is a socket.
[ -t $fd ] True if fd is opened on a terminal.
[ -u $file ] True if file exists and its set-user-id bit is set.
[ -w $file ] True if file exists and is writable.
[ -x $file ] True if file exists and is executable.
[ -O $file ] True if file exists and is owned by the effective user id.
[ -G $file ] True if file exists and is owned by the effective group id.

Directory Size Lister/Sorter
du -sm $(find $1 -type d -maxdepth 1 -xdev) | sort -g

style="font-weight: bold;">Finding Who Has a File Open

[slitt@mydesk slitt]$ /sbin/fuser -mu /d
/d: 1693(slitt) 1891c(slitt) 1894 1894c(slitt)
1907 1907c(slitt) 1908 1908c(slitt) 1909 1909c(slitt)
1910 1910c(slitt) 1912 1912c(slitt) 1913 1913c(slitt)
[slitt@mydesk slitt]$

What is .htaccess file


What is .hatccess file

.htacess stands for HyperText Access file.This is the default name of configuration file in the server side.It can also be placed in the directory whose security we want as it provides the ability to customize configuration for requests to the particular directory.

Although .htaccess is only a file, it can change settings on the servers and allow you to do many different things, the most popular being able to have your own custom 404 error pages. .htaccess isn't difficult to use and is really just made up of a few simple instructions in a text file.

.htaccess files are often used to specify the security restrictions for the particular directory, hence the filename "access." The .htaccess file is often accompanied by an .htpasswd file which stores valid usernames and their passwords.

Use of .htaccess file

1)Authorization and Authentication.
.htaccess files are often used to specify the security restrictions for the particular directory, hence the filename "access." The .htaccess file is often accompanied by an .htpasswd file which stores valid usernames and their passwords.
2)Customized error responses
Changing the page that is shown when a server-side error occurs, for example HTTP 404 Not Found.
These are some of the most common errors:

401 - Authorization Required
400 - Bad request
403 - Forbidden
500 - Internal Server Error
404 - Wrong page
3)Cache Control
.htaccess files allow a server to control User agent caching used by web browsers to reduce bandwidth usage, server load, and perceived lag.
4)Rewriting URLs
Servers often use .htaccess to rewrite "ugly" URLs to shorter and prettier ones.

LINUX-I


LINUX BASICS



Linux is an open source,free software operating system that was initially created as a hobby by a young student, Linus Torvalds, at the University of Helsinki in Finland. Linus had an interest in Minix, a small UNIX system, and decided to develop a system that exceeded the Minix standards. He began his work in 1991 when he released version 0.02 and worked steadily until 1994 when version 1.0 of the Linux Kernel was released. The kernel, at the heart of all Linux systems, is developed and released under the GNU General Public License and its source code is freely available to everyone. It is this kernel that forms the base around which a Linux operating system is developed. There are now literally hundreds of companies and organizations and an equal number of individuals that have released their own versions of operating systems based on the Linux kernel. More information on the kernel can be found at our sister site, LinuxHQ and at the official Linux Kernel Archives. The current full-featured version is Red Hat 9 is coming..
The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system. Variants of the GNU operating system, which use the kernel called Linux, are now widely used; though these systems are often referred to as “Linux”, they are more accurately called GNU/Linux systems.


What is Free Software?


“Free software” is a matter of liberty, not price. Free software is a matter of the users' freedom to run, copy, distribute, study, change and improve the software. More precisely, it refers to four kinds of freedom, for the users of the software:
•The freedom to run the program, for any purpose (freedom 0).
•The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.
•The freedom to redistribute copies so you can help your neighbor (freedom 2).
•The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.


Linux vs. Windows Design


•Windows has only recently evolved from a single-user design to a multi-user model. Linux is based on a long history of well fleshed-out multi-user design.
•Windows is monolithic, not modular, by design but Linux is mostly modular by design.
•Windows depends too heavily on an RPC model, Linux does not depend upon RPC to function, and services are usually configured not to use RPC by default.
•Linux servers are ideal for headless non-local administration, whereas Windows focuses on its familiar graphical desktop interface.