Commands by quitaiskiluisf (7)

  • This commando copies the file (which must reside in the current directory) to //<server>/<share-name>/<subdirectory>/<file> through the CIFS protocol (Samba share or Windows Share). It doesn't require you to mount the filesystem first. --directory "<subdirectory>" may be omitted in order to copy the file the the root of the share. The "%password" part may also be omitted. If doing so, smbclient will ask for the password interactively. To copy a file from a Windows/Samba share, change "put" for "get". smbclient --user=user%password --directory "&lt;subdirectory&gt;" --command "get &lt;file&gt;" //&lt;server&gt;/&lt;share-name&gt; Show Sample Output


    2
    smbclient --user=user%password --directory "<subdirectory>" --command "put <file>" //<server>/<share-name>
    quitaiskiluisf · 2018-05-12 19:18:42 154
  • When the wireless card is in AP mode, list the users which are connected to the network. It uses the new nl80211 based CLI configuration utility for wireless devices. It can be used, for example, in a dd-wrt based router through a telnet session to obtain client information. Show Sample Output


    0
    iw dev ath0 station dump
    quitaiskiluisf · 2017-01-09 00:50:49 16
  • After cloning an empty repository on the client ("git clone" just after "git init", for instance), "git push" fails. In order to be able to push to this repository for the first time, you need to run the above command. It will link your local "master" branch to the "master" branch in the origin server, and push the changes. This is only necessary only for the first push; after that, you can use just the commands "git push" or "git pull" in order to do this operations. Show Sample Output


    -1
    git push --set-upstream origin master
    quitaiskiluisf · 2017-01-09 00:32:14 23
  • When the wireless card is in AP mode, list the users which are connected to the network. Show Sample Output


    0
    wlanconfig <wireless_device> list sta
    quitaiskiluisf · 2013-06-08 13:46:51 20
  • This command will disconnect the user whose mac was specified from the current list of clients from the wireless network when the network card is working in access point mode. Works on atheros-based access points which use the madwifi driver (not sure, but don't think it will work on access points which are not atheros-based, as it uses the atheros's iwpriv extensions). It will not prevent the user from reconnecting to the network, but may force the user to roam to another AP, with stronger signal. Show Sample Output


    1
    iwpriv ath<x> kickmac <macaddress>
    quitaiskiluisf · 2013-06-08 13:41:24 7
  • Create an image of "device" and send it to another machine through the network ("target" and "port" sets the ip and port the stream will be sent to), outputting a progress bar On the machine that will receive, compress and store the file, use: nc -l -p <port> | 7z a <filename> -si -m0=lzma2 -mx=9 -ms=on Optionally, add the -v4g switch at the end of the line in order to split the file every 4 gigabytes (or set another size: accepted suffixes are k, m and g). The file will be compressed using 7z format, lzma2 algorithm, with maximum compression level and solid file activated. The compression stage will be executed on the machine which will store the image. It was planned this way because the processor on that machine was faster, and being on a gigabit network, transfering the uncompressed image wasn't much of a problem.


    8
    dd if=<device> | pv | nc <target> <port>
    quitaiskiluisf · 2012-01-27 18:37:36 18

  • 0
    mplayer -vc null -vo null -ao pcm <filename>
    quitaiskiluisf · 2011-09-11 04:03:02 3

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands


Check These Out

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Perl One Liner to Generate a Random IP Address

Create thumbnails and a HTML page for listing them (with links to sources)
The input images are assume to have the "JPG" extension. Mogrify will overwrite any gif images with the same name! Will not work with names with spaces.

Download all PDFs from an authenificated website
Replace *** with the appropiate values

Alias for lazy tmux create/reattach
If a tmux session is already running attach it, otherwise create a new one. Useful if you often forget about running tmuxes (or just don't care)

Install a LAMP server in a Debian based distribution
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.

find text in a file
this will find text in the directory you specify and give you line where it appears.

locating packages held back, such as with "aptitude hold "
locating packages held back, such as with "aptitude hold "

Readd all files is missing from svn repo
When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them! svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!

back ssh from firewalled hosts
host B (you) redirects a modem port (62220) to his local ssh. host A is a remote machine (the ones that issues the ssh cmd). once connected port 5497 is in listening mode on host B. host B just do a ssh 127.0.0.1 -p 5497 -l user and reaches the remote host'ssh. This can be used also for vnc and so on.


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: