Introduction to user commands

man intro
Tested on debian and ubuntu. Translations could be useless, so "LANG=C man intro" is a better alternative.

4
By: peppet
2010-02-17 10:11:56
man

These Might Interest You

  • Kill all processes belonging to a user, with a minimum of resource usage. Great for the times when a user fork-bombs the system and it's difficult to login or run commands.


    0
    sudo -u $USER kill -9 -1
    jeffenstein · 2012-09-14 12:03:25 0
  • This version prints current votes and commands for a user. Pass the user as an argument. While this technically "fits" as a one liner, it really is easier to look at as a shell script with extra whitespace. :) Show Sample Output


    2
    curl -s http://www.commandlinefu.com/commands/by/$1/xml | awk -F'</?div[^>]*>' '/class=\"command\"/{gsub(/&quot;/,"\"",$2); gsub(/&lt;/,"<",$2); gsub(/&gt;/,">",$2); gsub(/&amp;/,"\\&",$2); cmd=$2} /class=\"num-votes\"/{printf("%3i %s\n", $2, cmd)}'
    putnamhill · 2010-02-16 17:24:45 1
  • This utilizes the Requests and BeautifulSoup libraries in Python to retrieve a user page on commandlinefu, parse it (error-tolerant) and extract all the lines of the following format: gzip * To print them, a list comprehension is used to iterate over the values, and join() is called on a newline character. Show Sample Output


    2
    python -c "import requests; from bs4 import BeautifulSoup; print '\n'.join([cmd.text for cmd in BeautifulSoup(requests.get('http://www.commandlinefu.com/commands/by/${USER}').content, 'html.parser').find_all('div','command')])"
    funky · 2015-08-22 21:32:36 0
  • It executes commands as arguments to ssh, avoiding problematic shell expansions, without the need of writing the commands in question to a temporary file, just reading them from STDIN. Show Sample Output


    1
    echo "properly_escaped_command" | ssh user@host $(< /dev/fd/0)
    trantorvega · 2012-07-18 10:36:07 0

What Others Think

Excellent. Back to the basics!
linuxrawkstar · 435 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

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



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: