Commands by x3mboy (6)

  • 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

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

    ps aux | sort -rk 4,4 | head -n 10
    x3mboy · 2019-09-26 16:37:33 6
  • 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

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

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

    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 0
  • 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

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

What's this? 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

Convert entire audio library in parallel
Uses parallel processing Reiteration of my earlier command Usage lc Old_Directory New_DIrectory Old_Format New_Format lc ~/Music ~/Music_ogg mp3 ogg

Show what PID is listening on port 80 on Linux

RDP through SSH tunnel
This command will: 1. open an SSH tunnel to 2. go to background 3. wait for 10 seconds for the connection 4. during the 10 seconds wait it will localy run 'rdesktop' to connect to the remote host through the created SSH tunnel. Password-less log in can be achieved (when server allows it) by adding '-p ' to the 'rdesktop' command

Find the package that installed a command

Given process ID print its environment variables
Same as previous but compatible with BSD/IPSO

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Multi-thread any command
For instance: $ find . -type f -name '*.wav' -print0 |xargs -0 -P 3 -n 1 flac -V8 will encode all .wav files into FLAC in parallel. Explanation of xargs flags: -P [max-procs]: Max number of invocations to run at once. Set to 0 to run all at once [potentially dangerous re: excessive RAM usage]. -n [max-args]: Max number of arguments from the list to send to each invocation. -0: Stdin is a null-terminated list. I use xargs to build parallel-processing frameworks into my scripts like the one here:

Access to specific man page section
You can view the man pages from section five by passing the section number as an argument to the man command

Perl Command Line Interpreter
Can also just use the debug mode like this.

Copy ssh keys to user@host to enable password-less ssh logins.
Alternative for machines without ssh-copy-id

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.


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: