commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This will change the ownership of /../../somedirectory as well as all its subdirectories so they will be be owned by user2 - typically used when a directory is owned by root:root
This command dumps all SVN repositories inside of folder "repMainPath" (not recursively) to the folder "dumpPath", where one dump file will be created for each SVN repository.
According to tune2fs manual, reserved blocks are designed to keep your system from failing when you run out of space. Its reserves space for privileged processes such as daemons (like syslogd, for ex.) and other root level processes; also the reserved space can prevent the filesystem from fragmenting as it fills up. By default this is 5% regardless of the size of the partition.
Instead of looking for the right ip address, just pick whatever address you like and set a static ip mapping.
This command clone the first partition of the primary master IDE drive to the second partition
of the primary slave IDE drive (!!! back up all data before trying anything like this !!!)
When you need to add another tty device that can automatically start at boot time
adding users to groups on OS X is not a straightforward process, you need to use the new in built in Directory Service command line utility...
To get the connection information of protocol tcp and extended infortmation.
get diskusage of files (in this case logfiles in /var/log) modified during the last n days:
sudo find /var/log/ -mtime -n -type f | xargs du -ch
n -> last modified n*24 hours ago
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
=> so 7*24 hours (about 7 days) is -7
sudo find /var/log/ -mtime -7 -type f | xargs du -ch | tail -n1
Debian: Mark all dependent packages as manually installed. So they are not automatically removed if you remove some meta package - like gnome-desktop-environment for example.
Stores the currently active iptables rules to a file that will be applied upon reboot
If you don't save the rule set it won't be applied during a reboot
This allows the output to be sorted from largest to smallest in human readable format.
Tested with NTFS and found on this site:
The first 32256 bytes is the MBR
Plays the sound of the file, should sound like *some* kind of music, most files sound like static but some are really cool.
sudo cat /dev/sda > /dev/dsp
sudo cat /dev/sda5 | aplay
Check out http://bbs.archlinux.org/viewtopic.php?id=70937 for more variations!
semi-dupe--like http://www.commandlinefu.com/commands/view/985/generate-white-noise but with different syntax and program.
Retrieve top ip threats from http://isc.sans.org/sources.html and add them into iptables output chain.
This command starts screen with 'htop', 'nethogs' and 'iotop' in split-screen. You have to have these three commands (of course) and specify the interface for nethogs - mine is wlan0, I could have acquired the interface from the default route extending the command but this way is simpler.
htop is a wonderful top replacement with many interactive commands and configuration options. nethogs is a program which tells which processes are using the most bandwidth. iotop tells which processes are using the most I/O.
The command creates a temporary "screenrc" file which it uses for doing the triple-monitoring. You can see several examples of screenrc files here: http://www.softpanorama.org/Utilities/Screen/screenrc_examples.shtml
apt-get is pretty aggressive when it downloads, potentially hogging the bandwidth of your network. The 25 is in KB, change this to your needs.
Just copy and paste the code in your terminal.
Note : sudo apt-get for debian versions , change as per your requirement .
Source : www.h3manth.com