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

    smbclient --user=user%password --directory "<subdirectory>" --command "put <file>" //<server>/<share-name>
    quitaiskiluisf · 2018-05-12 19:18:42 0
  • 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

    iw dev ath0 station dump
    quitaiskiluisf · 2017-01-09 00:50:49 1
  • 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

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

    wlanconfig <wireless_device> list sta
    quitaiskiluisf · 2013-06-08 13:46:51 2
  • 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

    iwpriv ath<x> kickmac <macaddress>
    quitaiskiluisf · 2013-06-08 13:41:24 0
  • 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.

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

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

What's this? 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

formatting number with comma
it is not work with Cygwin's bash3.X. Test in Linux. use printf "%'f" number while it is floating point number

log your PC's motherboard and CPU temperature along with the current date
Uses the data in the /proc system, provided by the acpid, to find out the CPU temperature. Can be run on systems without lm-sensors installed as well.

Search from the command line using the API
Usage: cmdfu hello world

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Make alias pemanent fast
Simple function to permanently add an alias to your profile. Tested on bash and Ksh, bash version above. Here is the ksh version: PERMA () { print "[email protected]" >> ~/.profile; } Sample usage: PERMA alias la='ls -a'

dstat - a mix of vmstat, iostat, netstat, ps, sar...
This is a very powerful command line tool to gather statistics for a Linux system.

Speak the top 6 lines of your twitter timeline every 5 minutes.....
Pump up the chatter, run this script on a regular basis to listen to your twitter timeline. This is a rough first cut using several cli clips I have spotted around. There is no facility to not read those things already read to you. This could also easily be put in a loop for timed onslaught from the chatterverse, though I think it might violate several pointsof the Geneva Convention UPDATE - added a loop, only reads the first 6 twits, and does this every 5 mins.

Get windows IPv4 and nothing else
May be useful to get user's ip address over the phone, as users struggle to read through a long ipconfig result.

list block devices
Shows all block devices in a tree with descruptions of what they are.

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.


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: