Commands tagged user (9)

  • Usage exaple cmd echo 'Sure to continue ??'; read -n1 choi; if [ "$choi" = 'y' ] || [ "$choi" = 'Y' ]; then echo -e '\nExecuting..'; else echo 'Aborted'; fi Show Sample Output


    6
    read -N1
    totti · 2013-10-10 10:09:43 9

  • 2
    killall -u username
    bugmenot · 2011-11-24 20:26:38 5
  • Requires consolekit (works in e.g. Ubuntu). Here x11-display is DISPLAY Show Sample Output


    1
    ck-list-sessions
    unhammer · 2012-01-02 08:53:41 3
  • As a user, deletes all your posts from a MyBB board (provided you have the search page listings of all your posts saved into the same directory this command is run from). Full command: for i in *; do cat $i | grep pid | sed -e 's/;/\ /g' -e 's/#/\ /g' -e 's/pid=/\ /g' | awk -F ' ' '{print $2}' >> posts.txt; done; for c in `cat posts.txt`; do curl --cookie name= --data-urlencode name=my_post_key=\&delete=1\&submit=Delete+Now\&action=deletepost\&pid=$c --user-agent Firefox\ 3.5 --url http://url/editpost.php?my_post_key=\&delete=1\&submit=Delete+Now\&action=deletepost\&pid=$c; sleep 2s; done; echo


    0
    curl --cookie name=<cookie_value> --data-urlencode name=my_post_key=<post_key>\&delete=1\&submit=Delete+Now\&action=deletepost\&pid=$c --user-agent Firefox\ 3.5 --url http://url/editpost.php?my_post_key=<post_key>\&delete=1\&submit=Delete+Now\&action=dele
    mrlockfs · 2010-07-14 01:50:48 5
  • Function: char * crypt (const char *key, const char *salt) The crypt function takes a password, key, as a string, and a salt character array which is described below, and returns a printable ASCII string which starts with another salt. It is believed that, given the output of the function, the best way to find a key that will produce that output is to guess values of key until the original value of key is found. The salt parameter does two things. Firstly, it selects which algorithm is used, the MD5-based one or the DES-based one. Secondly, it makes life harder for someone trying to guess passwords against a file containing many passwords; without a salt, an intruder can make a guess, run crypt on it once, and compare the result with all the passwords. With a salt, the intruder must run crypt once for each different salt. For the MD5-based algorithm, the salt should consist of the string $1$, followed by up to 8 characters, terminated by either another $ or the end of the string. The result of crypt will be the salt, followed by a $ if the salt didn't end with one, followed by 22 characters from the alphabet ./0-9A-Za-z, up to 34 characters total. Every character in the key is significant. For the DES-based algorithm, the salt should consist of two characters from the alphabet ./0-9A-Za-z, and the result of crypt will be those two characters followed by 11 more from the same alphabet, 13 in total. Only the first 8 characters in the key are significant. Show Sample Output


    0
    useradd -m -p $(perl -e'print crypt("pass", "mb")') user
    mariusbutuc · 2010-09-03 19:00:56 6
  • This command is Linux compatible. It will prompt the user for a new password at next logon


    0
    chage -d 0 -m 0 -M 60 [user]
    mack · 2011-04-28 02:19:59 5
  • This command is AIX compatible. It will prompt the user for a new password at next logon


    0
    pwdadm -f ADMCHG [user]
    mack · 2011-04-28 02:22:03 11
  • cut -f1,2 - IP range 16 cut -f1,2,3 - IP range 24 cut -f1,2,3,4 - IP range 24 Show Sample Output


    0
    netstat -tn | grep :80 | awk '{print $5}'| grep -v ':80' | cut -f1 -d: |cut -f1,2,3 -d. | sort | uniq -c| sort -n
    krishnan · 2012-06-26 08:29:37 3
  • Install with `npm install unix-permissions`. https://github.com/ehmicky/unix-permissions Unix file permissions can take many shapes: symbolic (`ug+rw`), octal (`660`) or a list of characters (`drw-rw----`). `unix-permissions` enables using any of these (instead of being limited to a single one) with any CLI command. Show Sample Output


    -2
    unix-permissions convert.stat $(unix-permissions invert $(umask))
    ehmicky · 2019-02-05 14:06:08 389

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

Run a command only when load average is below a certain threshold
Good for one off jobs that you want to run at a quiet time. The default threshold is a load average of 0.8 but this can be set using atrun.

Convert spaces in file names to underscores

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"

list folders containing less than 2 MB of data
This command will search all subfolders of the current directory and list the names of the folders which contain less than 2 MB of data. I use it to clean up my mp3 archive and to delete the found folders pipe the output to a textfile & run: $ while read -r line; do rm -Rv "$line"; done < textfile

Burn CD/DVD from an iso, eject disc when finished.
cdrecord -scanbus will tell you the (x,y,z) value of your cdr (for example, mine is 3,0,0)

Run a command for blocks of output of another command
The given example collects output of the tail command: Whenever a line is emitted, further lines are collected, until no more output comes for one second. This group of lines is then sent as notification to the user. You can test the example with $ logger "First group"; sleep 1; logger "Second"; logger "group"

ASCII art of yourself
Use libcaca to render ascii chars on the webcam input... or don't.

batch convert Nikon RAW (nef) images to JPG
converts RAW files from a Nikon DSLR to jpg for easy viewing etc. requires ufraw package

a function to create a box of '=' characters around a given string.
First argument: string to put a box around. Second argument: character to use for box (default is '=') Same as command #4948, but shorter, and without the utility function.

Backup all mysql databases to individual files on a remote server
It grabs all the database names granted for the $MYSQLUSER and gzip them to a remote host via SSH.


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: