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 mount from sorted by
Terminal - Commands using mount - 60 results
INFILE=/path/to/your/backup.img; MOUNTPT=/mnt/foo; PARTITION=1; mount "$INFILE" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "$INFILE" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ]
6

Suppose you made a backup of your hard disk with dd:

dd if=/dev/sda of=/mnt/disk/backup.img

This command enables you to mount a partition from inside this image, so you can access your files directly.

Substitute PARTITION=1 with the number of the partition you want to mount (returned from sfdisk -d yourfile.img).

sudo mount -o remount,rw /
2009-03-01 13:36:05
User: blindgaenger
Functions: mount sudo
Tags: mount remount rw
3

Saved my day, when my harddrive got stuck in read-only mode.

mount -t proc{,,}
2009-02-26 12:53:58
User: alexfoo
Functions: mount
5

Run this in / in a chroot to get your own proc there.

function miso () { mkdir ~/ISO_CD && sudo mount -o loop "$@" ~/ISO_CD && cd ~/ISO_CD && ls; } function uiso () { cd ~ && sudo umount ~/ISO_CD && rm -r ~/ISO_CD; }
2009-02-25 03:41:35
User: vududevil
Functions: cd mkdir mount rm sudo umount
4

Add the functions to the .bashrc to make it work

Example: First go to the iso file directory and type:

----------------------------------------------------------------------------------------------------

user@box:~$ miso file.iso

----------------------------------------------------------------------------------------------------

It will put you into a temporary mounting point directory (ISO_CD) and will show the files

You can umount the iso file whatever the directory you are

----------------------------------------------------------------------------------------------------

user@box:~/ISO_CD$ uiso

----------------------------------------------------------------------------------------------------

It wil umount the iso file and remove the temporary directory in your home

mount -t cd9660 /dev/`mdconfig -a -t vnode -f discimg.iso` /cdrom
2009-02-19 06:31:14
User: mulad
Functions: mount
-1

FreeBSD version of the Linux command

mount discimg.iso /cdrom -o loop

The "mdconfig" command creates a device and prints the name (typically "md0"). Just append that to "/dev/" and mount.

Once unmounted, you can unconfigure the device with

mdconfig -d -u 0

using "0" for md0, "1" for md1, etc.

mount -o -t ntfs-3g /dev/sda1 /mnt/windows/c force
2009-02-16 10:51:57
User: RonaldConco
Functions: mount
1

If you have the library installed ntfs-3g, you will be able to mount the windows partition and write on it....

mount -o auto -t ntfs /dev/hda1 /windows
2009-02-16 10:45:06
User: RonaldConco
Functions: mount
-2

if the command is successful , you will get no output - only if an error has occurred will there be output

mount | grep : | tr -s ' ' -d 3 | xargs umount -v
mount -t tmpfs tmpfs /mnt -o size=1024m
2009-02-06 00:33:08
User: ajrobinson
Functions: mount
170

Makes a partition in ram which is useful if you need a temporary working space as read/write access is fast.

Be aware that anything saved in this partition will be gone after your computer is turned off.

mount /path/to/file.iso /mnt/cdrom -oloop
2009-02-05 17:28:06
User: nerd65536
Functions: mount
Tags: mount iso
42

"-o loop" lets you use a file as a block device