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 tagged samba from sorted by
Terminal - Commands tagged samba - 11 results
umount -t smbfs
2012-02-23 10:46:44
User: Velenux
Functions: umount
Tags: samba
-2

smbfs or cifs, depends on which you are using

mount|grep -e '//'|cut -d ' ' -f3| xargs -I {} umount {}
2012-01-17 01:20:09
Functions: cut grep mount umount xargs
Tags: samba
0

This is a handy command to put into ~/.bash_logout to automatically un-mount windows shares whenever the user logs out. If you use this on as a non-root account then you'll need to append sudo before umount and the user will need to have the appropriate sudoer rights to run the /bin/umount command.

chflags -R nouchg ./
2011-08-17 08:39:16
User: matths
0

otherwise you get this error message:

svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted

arp-scan -I eth0 -l | perl -ne '/((\d{1,3}\.){3}\d{1,3})/ and $ip=$1 and $_=`nmblookup -A $ip` and /([[:alnum:]-]+)\s+<00>[^<]+<ACTIVE>/m and printf "%15s %s\n",$ip,$1'
net rpc -I ADDRESS -U USERNAME%PASSWORD service {stop|start} SVCNAME
2010-06-29 17:12:36
User: f0rk
4

Control (stop, start, restart) a Windows Service from a Linux machine which has the `net` command (provided by samba).

echo "message" | smbclient -M NAME_OF_THE_COMPUTER
2010-02-28 21:10:46
User: mvrilo
Functions: echo
9

It will only work if the service NETSEND in the Windows machine is enabled.

nmblookup -A <ip>
2010-02-26 11:08:46
User: ivanatora
Tags: samba
1

Checks for PC samba name and workgroup. Works fine for Windows hosts and Linux/UNIX PCs running Samba.

sudo mount -t cifs -o credentials=/path/to/credenials //hostname/sharename /mount/point
2009-11-23 23:55:20
User: magma_camel
Functions: mount sudo
-2

mounts a samba share on a remote machine using a credentials file that can be in a file tht is not accessable by other users the file will look like:

username="username"

password="password"

best option i belive

smbpasswd -r <domain-server> -U <user name>
2009-08-12 07:46:48
User: greppo
6

If you use Linux in a Windows domain and there are N days to expiry, this is how you can change it without resorting to a windows machine.

while (( $i != 0 )) { smbstatus; sleep 5; clear }
2009-06-03 13:26:30
Functions: clear sleep
Tags: unix samba zsh
-4

See smbstatus Output within a 5 second interval (for monitoring smb access)

sudo vi /etc/fstab; Go//smb-share/gino /mnt/place smbfs defaults,username=gino,password=pass 0 0<esc>:wq; mount //smb-share/gino
2009-04-02 16:04:35
User: GinoMan2440
Functions: mount sudo vi
4

the middle command between the ; and ; is the vi commands that insert that line into the last line of the file, the esc with the carets is literally hitting the escape key, you have to have the smbfs package installed to do it, I use it to access my iTunes music on my mac from my linux PC's with amarok so I can play the music anywhere in the house. among other things, it allows you to access the files on that share from your computer anytime you're on that network.