Commands by x3mboy (8)

  • Simple commant to tar a path


    -2
    tar -cvzf file.tar.gz path
    x3mboy · 2022-09-17 16:40:09 943
  • Sort disk usage from directories in the current directory Show Sample Output


    2
    du --max-depth=1 -h . | sort -h
    x3mboy · 2022-08-23 14:58:57 552
  • Since systemd-resolved was implemented, add a DNS server have become weirder and harder than before. With this command, you can add a DNS server on-the-fly tied to an specific interface


    5
    sudo systemd-resolve --interface <NombreInterfaz> --set-dns <IPDNS> --set-domain mydomain.com
    x3mboy · 2021-09-21 14:43:48 364
  • It displays the top 10 processes sorted by memory usage Show Sample Output


    3
    ps aux | sort -rk 4,4 | head -n 10
    x3mboy · 2019-09-26 16:37:33 640
  • This command sent the Python version to a file. This is intended to be used in scripts. For some reason, simple redirections didn't work with "python -V" Show Sample Output


    0
    echo "$(python -V 2>&1)" > file
    x3mboy · 2018-11-06 20:52:49 551
  • Short list about top 10 processes, sorted by CPU usage Show Sample Output


    3
    ps aux | sort -rk 3,3 | head -n 10
    x3mboy · 2018-10-29 20:00:36 1027
  • This will use tput to place the command (date %T in this case) in the upper right corner of the terminal


    0
    while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-11));echo -e "\e[31m`date +%T`\e[39m";tput rc;done &
    x3mboy · 2017-11-16 18:07:39 19
  • This is a regular find with the -wholename parameter to let it know what name pattern he need to look and then the -mmin -15 to know the last 15 minutes. Show Sample Output


    0
    find /var/log -wholename "*.log" -mmin -15
    x3mboy · 2017-08-03 15:47:43 15

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

Check how far along (in %) your program is in a file
Say you're started "xzcat bigdata.xz | complicated-processing-program >summary" an hour ago, and you of course forgot to enable progress output (you could've just put "awk 'NR%1000==0{print NR>"/dev/stderr"}{print}'" in the pipeline but it's too late for that now). But you really want some idea of how far along your program is. Then you can run the above command to see how many % along xzcat is in reading the file. Note that this is for the GNU/Linux version of lsof; the one found on e.g. Darwin has slightly different output so the awk part may need some tweaks.

Quickly move the cursor to different parts of the command line based on a mark.
Use 'ctrl-@' to set a mark. See the first comment for a better explanation.

Convert all files for iPhone with HandbrakeCLI

Skype conversation logs to IRC-format logs

vi show line numbers
you don't have to spell out numbers, you can just use nu

find and delete empty dirs, start in current working dir

Find the package that installed a command

Sort all running processes by their memory & CPU usage
you can also pipe it to "tail" command to show 10 most memory using processes.

Find the package that installed a command

print shared library dependencies
May be used on (embedded) systems lack ldd


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: