Commands tagged privilege (2)

  • dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

    dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
    totti · 2013-01-15 18:47:21 0
  • Extracting .gz files and placing the output in another directory in one command line is convenient thing. I just followed some how-to to install Nagios on Ubuntu Lucid Lynx but they give the method to install from archives. I wished to install from the repository. If you do so some files are missing. I've not tested yet but this is an example command line I did to extract sudo sh -c 'gunzip -c /usr/share/doc/nagios3-common/examples/template-object/templates.cfg.gz > /etc/nagios3/objects/templates.cfg' We need privilege to write the destination file. Show Sample Output

    sudo sh -c 'gunzip -c source.gz > destination'
    UnixNeko · 2011-07-05 23:51:01 1

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

Get the IP address

date offset calculations
The date command does offset calculations nicely, handles concepts like "a month" as you'd expect, and is good for offsets of at least 100M years in either direction.

Convert seconds to human-readable format
This example, for example, produces the output, "Fri Feb 13 15:26:30 EST 2009"

Use xdg-open to avoid hard coding browser commands
I rarely use the system menu to start applications. I use keyboard shortcuts instead. Keyboard shortcuts are convenient time savers. To configure the shortcuts I use gconf-editor or CompizConfig Settings Manager (if I have Compiz turned on). Lately I've been using Chromium as my browser. Since Chromium is under heavy development it occasionally becomes unusable and I have to switch back to Firefox. I was hard-coding the browser command in my keyboard shortcuts. This became problematic with frequent browser hopping. I now use the xdg-open command when defining my keyboard shortcuts. xdg-open opens a file or URL in the user's preferred application. In the metacity keybinging_commands I have xdg-open where I used to have firefox Now when switching browsers I don't have to update each keyboard binding command I just change my default browser in Ubuntu by clicking through the menu: System / Preferences / Preferred Applications / Web Browser. xdg-open is more convenient for this browser hopper.

bulk rename files with sed, one-liner
Renames all files in a directory named foo to bar. foobar1 gets renamed to barbar1 barfoo2 gets renamed to barbar2 fooobarfoo gets renamed to barobarfoo NOTE: Will break for files with spaces AND new lines AND for an empty expansion of the glob '*'

get only time of execution of a command without his output

Remove a range of lines from a file

Remove spaces from filenames - through a whole directory tree.
An example of zsh glob qualifiers.

Another Matrix Style Implementation
A bit different from some of the other submissions. Has bold and uses all c printable characters. Change the bs=value to speed up and increase the sizes of the bold and non-bold strings.

List just the executable files (or directories) in current directory
Does an 'ls' on just the files and directories in the current directory with an execute bit turned on. This version will list directories. Just tack on "-type f" to the start of the find to omit listing directories and list only files.

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: