Argument List Too Long

Getting an "Argument list too long" error using Linux?

This is because you are passing too many arguments to an executable.
For example, using *.html below results in too many arguments to /bin/rm:

rm *.html
bash: /bin/rm: Argument list too long

One solution is to use Bash control loops to iterate through arguments.

for HTMLFILE in *.html
> do
> rm -f $HTMLFILE
> done

Alternatively, the find command can be used to manipulate large data sets.
The following find command is identical in result to the for loop shown above.

bash$ find ./ -maxdepth 1 -name '*.html' -exec rm -f {} \;

Removing leading `/' from member names

Have you ever seen this error when using tar?

tar -czf etc.tgz /etc
Removing leading `/' from member names

Tar is removing the leading / from the archive file, and warning you about it. Although you can redirect STDERR to /dev/null, doing so can result in missed errors. Instead, use tar with the -P or --absolute-names switch. They do the same thing: leave the leading / in the archived files.

tar -czPf etc.tgz /etc

When you untar the archive without -P, the leading / will still equate to your current working directory. Use the -P when untarring to restore from archive to the absolute path name. For example:

The following creates ./etc (dot, slash, etc)

tar -xzf etc.tgz

This overwrites /etc (slash, etc)!

tar -xzPf etc.tgz

RPM -e Error Specifies Multiple Packages

Running into this?

bash$ sudo rpm -e zlib-devel
error: "zlib-devel" specifies multiple packages

This is because zlib-devel.i386 and zlib-devel.x86_64 are both installed. It is possible to remove them individually:

bash$ sudo rpm -e zlib-devel.i386
bash$ sudo rpm -e zlib-devel.x86_64

By default, Fedora, CentOS and RedHat shells do not specify the architecture of an RPM in the query format. This can lead to duplicate entries from queries:

bash$ rpm -q zlib-devel

You can use the --queryformat switch when running rpm -q, or configure the query format setting in ~/.rpmmacros.

bash$ rpm -q --queryformat "%{name}.%{arch}\n" zlib-devel
bash$ cat ~/.rpmmacros
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}
bash$ rpm -q zlib-devel

Syndicate content