dpkg --get-selections
will show you a complete list of packages installed on your Ubuntu system
and
rpm -qa
will give you the complete list on a Fedora / Redhat /CentOS system
since these lists are long its a good idea to pipe them to less
dpkg --get-selections | less
and
rpm -qa | less
Monday, September 28, 2009
Saturday, September 26, 2009
Friday, September 25, 2009
Argument list too long
Today I was limited by rm
I needed to clean up a folder by deleting previous years (2008) log files which amounted to a few thousand files
rm logs-2008*
returned me the error
/bin/rm:Argument too long
The reason for this error is a limitation of your running kernel and will limit you to other commands as well. Like mv and cp, if the amount of files you want to act on is larger than the set limitation.
a work around is to pipe the matching files to rm one at a time.
To do this, issue the following command
find -name 'log2008*' | xargs rm (substitute 'log2008*' for your search string)
If the files you are trying to remove have spaces in them, then you need to use the following command
find -name 'log2008*' | -print0 | xargs -0 rm
I needed to clean up a folder by deleting previous years (2008) log files which amounted to a few thousand files
rm logs-2008*
returned me the error
/bin/rm:Argument too long
The reason for this error is a limitation of your running kernel and will limit you to other commands as well. Like mv and cp, if the amount of files you want to act on is larger than the set limitation.
a work around is to pipe the matching files to rm one at a time.
To do this, issue the following command
find -name 'log2008*' | xargs rm (substitute 'log2008*' for your search string)
If the files you are trying to remove have spaces in them, then you need to use the following command
find -name 'log2008*' | -print0 | xargs -0 rm
Thursday, September 24, 2009
Static Routes
To add a static route to say the 10.10.1.0/24 network from your machine through your gateway router who's IP is 192.168.1.1
route add -net 10.10.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0
will add the route to your kernel and it will be available immediately. However this will not survive a reboot.
To make this persistent after a reboot you need to input the route into a configuration file
on Ubuntu edit
/etc/network/interfaces
and Red hat / Centos / Fedora
edit /etc/sysconfig/network-scripts/route-eth0
if the route-eth0 file file does not exist (it probably won't) then create it
and add the following
10.10.1.0/24 via 192.168.1.1
save the file and then restart networking to read in the new route
/etc/init.d/networking restart
route add -net 10.10.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0
will add the route to your kernel and it will be available immediately. However this will not survive a reboot.
To make this persistent after a reboot you need to input the route into a configuration file
on Ubuntu edit
/etc/network/interfaces
and Red hat / Centos / Fedora
edit /etc/sysconfig/network-scripts/route-eth0
if the route-eth0 file file does not exist (it probably won't) then create it
and add the following
10.10.1.0/24 via 192.168.1.1
save the file and then restart networking to read in the new route
/etc/init.d/networking restart
Subscribe to:
Posts (Atom)