Commands using sudo (537)


  • 0
    sudo apt-get install lamp-server^ phpmyadmin
    imericurnot · 2012-11-15 01:08:00 10

  • 0
    sudo ettercap -T -Q -M arp -i wlan0 // //
    jorgemendoza · 2012-11-20 23:42:53 14
  • Magic line will extract almost all possible archives from current folder in its own folders. Don't forget to change USER name in sudo command. sed is used to create names for folders from archive names w/o extension. You can test sed expression, used in this command: arg='war.lan.net' ; x=$(echo $arg|sed 's/\(.*\)\..*/\1/') ; echo $x If some archives can't be extracted, install packages: apt-get install p7zip-full p7zip-rar Hope this will save a lot of your time. Enjoy.


    0
    for ARG in * ; do sudo -u USER 7z x -o"$(echo $ARG|sed 's/\(.*\)\..*/\1/')" "$ARG" ; done
    n158 · 2012-12-31 19:47:24 7
  • MAC OSX doesn't come with a locate command, This will do the same thing as the locate command on a typical Linux OS. Simply add it to your ~/.bash_profile


    0
    alias locate='if [ $((`date +%s`-`eval $(stat -s /var/db/locate.database); echo $st_mtime`)) -gt 3600 ]; then echo "locate: db is too old!">/dev/stderr; sudo /usr/libexec/locate.updatedb; fi; locate -i'
    jhyland87 · 2013-01-21 17:45:50 4

  • 0
    sudo apt-get <apt-get command and options> --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p" > dowload_deb_list.txt
    totti · 2013-02-09 09:36:53 4

  • 0
    sudo port selfupdate ; echo '---------' ; sudo port upgrade outdated
    roozbeh · 2013-03-21 04:07:54 4
  • Your computer's name is raspberrypi and you want to rename it to pita1. This command will change both the hostname and the name used for netwrk communications.


    0
    sudo sed -i 's/raspberrypi/pita1/' /etc/hosts /etc/hostname; sudo reboot
    egeoffray · 2013-04-16 07:27:41 6
  • Install Ksuperkey one command in Kubuntu. You must manually add ksuperkey to autostart in System Settings KDE.


    0
    sudo apt-get install git gcc make libx11-dev libxtst-dev pkg-config -y && git clone https://github.com/hanschen/ksuperkey.git && cd ksuperkey && make && sudo mv ksuperkey /usr/bin/ksuperkey && cd ~ && rm -rf ksuperkey
    FadeMind · 2013-04-17 07:12:46 6
  • Replace default command in skype.desktop file.


    0
    sudo sed -i 's/Exec=skype %U/Exec=skype --disable-cleanlooks -style GTK %U/' /usr/share/applications/skype.desktop
    FadeMind · 2013-04-17 08:43:00 6
  • Advanced information about RAM.


    0
    sudo dmidecode --type 17
    FadeMind · 2013-04-18 20:13:07 4
  • wait a hour and 10 seconds to shutdown Show Sample Output


    0
    sudo shutdown -h <hour:minute>
    devlucas · 2013-04-19 18:54:38 26

  • 0
    sudo shutdown -h now
    permanaj · 2013-04-23 02:34:48 5

  • 0
    sudo su; sync; echo 3 > /proc/sys/vm/drop_caches
    ab_simas · 2013-04-23 14:07:15 4

  • 0
    sudo useradd -U -m -s /bin/bash new_user
    monmo · 2013-04-29 06:32:49 7

  • 0
    sudo pacman-mirrors -g
    unixmonkey57489 · 2013-05-16 13:55:39 7
  • Here you have to choose the correct kernel number, for example linux38.


    0
    sudo pacman -S virtualbox-guest-utils
    unixmonkey57489 · 2013-05-16 14:39:38 14
  • Inner "ps...grep..." command searches for a process matching the specified . "lsof -p lists all file descriptors owned by . Includes open files, sockets, devices, etc... Show Sample Output


    0
    sudo lsof -p `sudo ps aux | grep -i neo4j | grep -v grep | awk '{ print $2 }'`
    andycunn · 2013-06-02 10:15:30 7
  • Counts of messages by recipient, with frozen messages excluded. Show Sample Output


    0
    sudo /usr/sbin/exim -bp | sed -n '/\*\*\* frozen \*\*\*/,+1!p' | awk '{print $1}' | tr -d [:blank:] | grep @ | sort | uniq -c | sort -n
    blueskin · 2013-06-04 10:49:14 8

  • 0
    sudo dumpe2fs /dev/sda1 | grep superblock
    rugina · 2013-06-25 08:48:49 182

  • 0
    sudo port selfupdate && sudo port upgrade outdated && sudo port clean --all installed && sudo port -f uninstall inactive
    noah · 2013-06-26 01:12:33 10
  • If you are an unlucky soul behind a corporate firewall you will likely find that downloading gpg keys is blocked. This is because the hkp protocol uses port 11371 by default to transfer the key. By adding "hkp://" to the beginning of the hostname and ":80" to the end you are asking gpg to try using port 80 to connect (less likely to be blocked by a firewall). This relies on the remote server answering to requests over port 80. Show Sample Output


    0
    sudo apt-key adv --keyserver hkp://keys.gnupg.net:80 --recv-keys [key to get here]
    phattmatt · 2013-07-23 08:29:40 7
  • bit of a contrived example and playing to my OCD but nice for quick scripted output of listening ports which is sorted by port, ip address and protocol. Show Sample Output


    0
    sudo netstat -plntu --inet | sort -t: -k2,2n | sort --stable -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | sort -s -t" " -k1,1
    thechile · 2013-08-13 09:21:26 8
  • Back up /etc directory with a name based on the current date and the hostname of the machine, then chown the file for the current user for use.


    0
    sudo tar -zcvf $(hostname)-etc-back-`date +%d`-`date +%m`-`date +%y`.tar.gz /etc && sudo chown $USER:$USER $(hostname)-etc-back*
    thanosme · 2013-08-18 12:49:11 19

  • 0
    sudo adduser [username] lp && sudo adduser [username] lpadmin && sudo hp-setup -i
    Romero · 2013-08-25 14:21:25 10
  • Install all build dependencies for a given package Show Sample Output


    0
    sudo apt-get build-dep rhythmbox
    darlanalves · 2013-10-07 23:13:19 6
  • ‹ First  < 12 13 14 15 16 >  Last ›

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

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Realtime apache hits per second
Change the cut range for hits per 10 sec, minute and so on... Grep can be used to filter on url or source IP.

Synchronize date and time with a server over ssh
Set Remote Server Date using Local Server Time (push)

Copy from host 1 to host 2 through your host

Display rows and columns of random numbers with awk
Displays six rows and five columns of random numbers between 0 and 1. If you need only one column, you can dispense with the "for" loop.

See system users

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Convert all .flac from a folder subtree in 192Kb mp3
find . -type f -iname '*.flac' # searches from the current folder recursively for .flac audio files | # the output (a .flac audio files with relative path from ./ ) is piped to while read FILE; do FILENAME="${FILE%.*}"; flac -cd "$FILE" | lame -b 192 - "${FILENAME}.mp3"; done # for each line on the list: # FILE gets the file with .flac extension and relative path # FILENAME gets FILE without the .flac extension # run flac for that FILE with output piped to lame conversion to mp3 using 192Kb bitrate

Get the full path of a bash script's Git repository head.
Rather than complicated and fragile paths relative to a script like "../../other", this command will retrieve the full path of the file's repository head. Safe with spaces in directory names. Works within a symlinked directory. Broken down: $cd "$(dirname "${BASH_SOURCE[0]}")" temporarily changes directories within this expansion. Double quoted "$(dirname" and ")" with unquoted ${BASH_SOURCE[0]} allows spaces in the path. $git rev-parse --show-toplevel gets the full path of the repository head of the current working directory, which was temporarily changed by the "cd".

Define Google Chrome urpmi media source for Mandriva/Mageia (works for both 32-bit and 64-bit systems)
This command adds a urpmi media source called "google-chrome" to the urpmi configuration on Mandriva or Mageia. Needs to be run as root. We specify the option "--update" so that when Google provides a newer version of Google Chrome web browser in their download system then running a system update (eg: "urpmi --auto-update") will result in our copy of Google Chrome getting updated (along with any other Mandriva/Mageia pending updates). To install Google Chrome from this source, use: urpmi google-chrome-stable #install Google chrome web browser


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: