Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands using tune2fs from sorted by
Terminal - Commands using tune2fs - 10 results
sudo tune2fs -l $(df -h / |(read; awk '{print $1; exit}')) | grep -i created
2013-08-08 15:18:09
User: thechile
Functions: awk df grep sudo tune2fs
12

..not guaranteed to always be accurate but fun to see how old you Linux installation is based on the root partitions file system creation date.

tune2fs -l $(df -P / | awk 'NR==2 {print $1}') | sed -n 's/^.*created: *//p'
2012-05-31 12:12:35
User: forcefsck
Functions: awk df sed tune2fs
0

Find out the earliest installation time of a linux system by getting the / filesystem creation time. This example is only valid the os is installed on an ext2/3/4 filesystem.

tune2fs -m 1 /dev/sda6
2011-12-07 10:20:01
User: Dhinesh
Functions: tune2fs
Tags: tune2fs
6

This command changes the reserved space for privileged process on '/dev/sda' to 1 per cent.

tune2fs -l /dev/XXXX | grep -w ^"Block size:"
2011-02-10 16:39:14
User: ncaio
Functions: grep tune2fs
-1

the result of the command helped a check the Maximum file size and Maximum file system size.

EXT3 Exemple:

Block size; MAX File size; Maximum file system size

1 KiB; 16 GiB ; 2 TiB

2 KiB ; 256 GiB ; 8 TiB

4 KiB ; 2 TiB ; 16 TiB

8 KiB[limits 1]; 2 TiB; 32 TiB

tune2fs -c -1 -i 0 /dev/VG0/data
tune2fs -l $(df -P / | tail -n1 | cut -d' ' -f1 ) | grep 'Filesystem created:'
tune2fs -j /dev/sdX
sudo tune2fs -m 1 /dev/sda4
2009-09-14 21:11:55
User: bassel
Functions: sudo tune2fs
2

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.

http://www.ducea.com/2008/03/04/ext3-reserved-blocks-percentage/

tune2fs -O extents,uninit_bg,dir_index /dev/yourpartition
2009-06-23 17:42:01
User: starchox
Functions: tune2fs
5

Before doing this, back-up all data on any ext3 partitions that are to be converted to ext4.

After running previous command you MUST run fsck, is needed to return the filesystem to a consistent state.

fsck -pDf /dev/yourpartition

Edit /etc/fstab and change the 'type' from ext3 to ext4 for any partitions that are converted to ext4.

df / | awk '{print $1}' | grep dev | xargs tune2fs -l | grep create
2009-02-16 18:45:03
User: Kaio
Functions: awk df grep tune2fs xargs
9

Very useful set of commands to know when your file system was created.