Commands tagged arch linux (15)

  • An alternative to: python -m SimpleHTTPServer for Arch Linux source: http://archlinux.me/dusty/2010/01/15/simplehttpserver-in-python-3/ Show Sample Output


    6
    python3 -m http.server
    TheShadowFog · 2011-12-07 23:43:21 15
  • This one-liner will output installed packages sorted by size in Kilobytes. Show Sample Output


    4
    paste <(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') <(pacman -Q | awk '{print $1; }') | sort -n | column -t
    BruceLEET · 2011-01-07 18:43:18 7
  • -Qdt Lists dependencies/packages which are no longer required by any packages -q Output only package name (not the version number) -R Remove package(s) Rest is self-explanatory. I just started out with Arch - so if there is any better/standard method to achieve the same - please suggest.


    4
    pacman -Qdt -q | xargs pacman --noconfirm -R
    b_t · 2014-02-27 05:17:57 8
  • Writes hybrid ISO directly to USB stick; replace /dev/sdb with USB device in question and the ISO image link with the link of your choice


    4
    wget -O /dev/sdb https://cdimage.ubuntu.com/daily-live/current/eoan-desktop-amd64.iso
    realkstrawn93 · 2019-09-19 04:03:13 115
  • Adding this alias to ~/.bashrc or, better yet, the system-wide /etc/bash.bashrc (as in my setup) will make it possible to not only run pacman as any user without needing to prepend sudo but will also ensure that it always assumes that the user knows what he or she is doing. Not the best thing for large multi-user enterprise setups at all to say the least, but for home (desktop) use, this is a fantastic time-saver.


    3
    alias pacman=‘sudo pacman --noconfirm’
    realkstrawn93 · 2021-12-28 20:29:13 569
  • If, while using a program, you get an error similar to: error while loading shared libraries: libusb-0.1.so.4: cannot open shared object file: No such file or directory Use pacman or pkgfile to search for the package that owns the missing library https://wiki.archlinux.org/index.php/General_troubleshooting#Message:_%22error_while_loading_shared_libraries%22 Show Sample Output


    2
    pacman -Fs libusb-0.1.so.4
    Mouath · 2019-03-07 16:15:10 35
  • The lastb command presents you with the history of failed login attempts (stored in /var/log/btmp). The reference file is read/write by root only by default. This can be quite an exhaustive list with lots of bots hammering away at your machine. Sometimes it is more important to see the scale of things, or in this case the volume of failed logins tied to each source IP. The awk statement determines if the 3rd element is an IP address, and if so increments the running count of failed login attempts associated with it. When done it prints the IP and count. The sort statement sorts numerically (-n) by column 3 (-k 3), so you can see the most aggressive sources of login attempts. Note that the ':' character is the 2nd column, and that the -n and -k can be combined to -nk. Please be aware that the btmp file will contain every instance of a failed login unless explicitly rolled over. It should be safe to delete/archive this file after you've processed it. Show Sample Output


    1
    sudo lastb | awk '{if ($3 ~ /([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}/)a[$3] = a[$3]+1} END {for (i in a){print i " : " a[i]}}' | sort -nk 3
    sgowie · 2012-09-11 14:51:10 4

  • 0
    pacman -Qi $(pacman -Qq)|grep 'Name\|Size'| cut -d: -f2 | paste - - | column -t | sort -nk2
    minus · 2011-05-03 13:02:06 4
  • M is size in megabytes, man expac to see other sizes %m is install size %k is download size


    0
    expac -S -H M "%m %n"|sort -n
    gtmanfred · 2012-06-14 19:41:21 3
  • I used this (along with a modified one replacing `mkv` with `srt`) to remove the slight differences in who the provider of the video / matching subtitle was (as they are the same contents and the subs match anyway). So now VLC (and other video players) can easily guess the subtitle file. Show Sample Output


    0
    perl-rename -v 's/720p.+mkv/720p\.mkv/' *.mkv
    benkaiser · 2014-09-25 14:07:47 9
  • This version accounts for the MiB/KiB suffix output by pacman these days.


    0
    pacman -Qi | grep 'Name\|Size\|Description' | cut -d: -f2 | paste - - - | awk -F'\t' 'BEGIN{ s["MiB"]=1024; s["KiB"]=1;} {split($3, a, " "); print a[1] * s[a[2]], "KiB", $1}' | sort -n
    Timo · 2018-04-24 13:29:57 154

  • 0
    echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf
    HaoZeke · 2018-08-13 07:30:55 302
  • dmesg -t: no timestamp -W: follow new messages -l: log-level notice gawk if the fourth word is "Attached" echo a sentence through espeak


    0
    dmesg -tW -l notice | gawk '{ if ($4 == "Attached") { system("echo New device attached | espeak") } }
    BigZ · 2020-09-06 08:18:26 271

  • 0
    sudo pacman -Scc && pamac clean -b
    bugmenot · 2022-08-24 19:10:38 552
  • This, like the other commands listed here, displays installed arch packages. Unlike the other ones this also displays the short description so you can see what that package does without having to go to google. It also shows the largest packages on top. You can optionally pipe this through head to display an arbitrary number of the largest packages installed (e.g. ... | head -30 # for the largest 30 packages installed) Show Sample Output


    -1
    pacman -Qi | grep 'Name\|Size\|Description' | cut -d: -f2 | paste - - - | awk -F'\t' '{ print $2, "\t", $1, "\t", $3 }' | sort -rn
    GetterNoCheddar · 2012-11-20 03:40:55 8

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

enable all bash completions in gentoo
enable each bash completion that you have installed at your system, that's very nice ;)

Create md5sum of files under the current dir excluding some directories
Useful if you want get all the md5sum of files but you want exclude some directories. If your list of files is short you can make in one command as follow: $ find . -type d \( -name DIR1 -o -name DIR2 \) -prune -o -type f -exec md5sum {} \; Alternatively you can specify a different command to be executed on the resulting files.

silent/shh - shorthand to make commands really quiet
Sometimes I just want to run a command quietly but all that keyboard shifting makes my fingers hurt. This little function does the job eg.: $ if shh type less; then PAGER=less; fi

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"

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"

find out how many days since given date
You can also do this for seconds, minutes, hours, etc... Can't use dates before the epoch, though.

memory usage

Transfer Entire recursive from one host to another. Only copies files that are newer or do not exist
From opposite host To copy remote to local rsync -aE -e "ssh -pPortnumber" user@hostA:directory target_dir

Get the beats per minute from an audio track
Requires bpm-tools https://www.pogo.org.uk/~mark/bpm-tools/

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"


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: