r/UnixProTips • • Feb 05 '15

moreutils

10 Upvotes

There's a useful collection of little cli helpers called moreutils, as a play on coreutils obviously.

The most useful one for me is vidir which let's you edit the filenames supplied (or if no argument the current directory) with your EDITOR. So if i do mass renaming i can do it in vim. <3


r/UnixProTips • • Feb 05 '15

C-x, C-e to edit long commands

10 Upvotes

r/UnixProTips • • Jul 06 '25

Have you used this distibution sometime?

Post image
9 Upvotes

r/UnixProTips • • Sep 14 '22

Linux Guide

9 Upvotes

Linux Guide. Learn about Linux Hardware vendors, Linux in the Cloud, Desktop Environents, Window mangers, Linux Distributions, Linux Security Hardening, Gaming (NVIDIA, AMD, Intel ARC), and Popular Software Apps.


r/UnixProTips • • Jan 13 '21

UPT Pro Guide

9 Upvotes

Unix is our favorite child. Flexible, applicable, customizable- wait, did you say customizable?

(this post is a work-in-progress, all recommendations accepted in the comments)

Vocabulary

  • POSIX-compliant: Being POSIX-compliant for an OS means that it supports those standards (e.g., APIs), and thus can either natively run UNIX programs, or at least porting an application from UNIX to the target OS is easy/easier than if it did not support POSIX. [superuser]

Shells

  • Bash: the default shell on most installations

  • Zsh: spelling correction, automation, and better plugin management

  • Fish: the non-POSIX oriented shell

Getting Help

IRC Channels:

  • #vim, #emacs

Discord servers:

  • Vi-tality, the vim and other things oriented server.


r/UnixProTips • • Apr 30 '18

If you have pulseaudio installed but need to run a TTY session, you can still run start-pulseaudio-x11 for audio capabilities.

9 Upvotes

Tried this one day when I logged into a TTY but wanted to fire up cmus in a tmux session. Sure enough, it works. (That said, I didn't realize it was a simple shell script at the time. It's kind enough not to bail out even if it can't find a $DISPLAY.)

Nothing too special, but for those who didn't already know, it might make it just a little easier to entertain yourself during those otherwise tedious troubleshooting sessions.


r/UnixProTips • • Feb 22 '15

grep . /files/you/want/*

9 Upvotes

Simple but effective way to cat a bunch of files with the filename: before each line.

Handy if you want to have a look at a few smaller files at once. Also, it squeezes out empty lines.


r/UnixProTips • • Feb 04 '15

Bash function to extract all archives

9 Upvotes

Use one command to extract them all:

function extract()
{
if [ -z "$1" ]; then
    echo "Usage: extract [FILE]"
else
    if [ -f "$1" ]; then
        case "$1" in
            *.7z) 7z x "$1" ;;
            *.bz2) bunzip2 "$1" ;;
            *.exe) cabextract "$1" ;;
            *.gz) gunzip "$1" ;;
            *.lzma) unlzma "$1" ;;
            *.rar) unrar x -ad "$1" ;;
            *.tar.bz2) tar xvjf "$1" ;;
            *.tar.gz) tar xvzf "$1" ;;
            *.tar) tar xvf "$1" ;;
            *.tar.xz) tar xvJf "$1" ;;
            *.tbz2) tar xvjf "$1" ;;
            *.tgz) tar xvzf "$1" ;;
            *.xz) unxz "$1" ;;
            *.zip) unzip "$1" ;;
            *.Z) uncompress "$1" ;;
            *) echo "extract: '$1' - unknown archive method" ;;
        esac
    else
        echo "'$1' - file does not exist"
    fi
fi
}

r/UnixProTips • • Mar 25 '20

Where do these panes come from? Thought they were kind of cool.

Post image
8 Upvotes

r/UnixProTips • • Jul 14 '15

Closing idle sessions per user

8 Upvotes

Our environment consists of CentOS and we have 5 login nodes (blades) that load balance for approximately 150 users via OpenLDAP authentication. We're noticing that folks are leaving sessions opened for as much as two months at a time, but they use these login nodes for a jumping off point to other blades where they can kick off such things as Matlab, gdb, ddd, etc.

We're having to reboot these blades from time to time because the firefox, NX and other resource-intensive programs yank too much CPU/memory and they end up becoming unresponsive. Probably a memory leak within the program(s) they're running, but the inherent problem seems to be that they simply don't remember to logout. Since each user has their own SHELL type, i.e. bash, ksh, csh, tcsh, etc., we'll have to create a . file in each of their home directories that contain the timeout for anything more than 7 days. The question is, would this be the way you all handle this or is there a more efficient approach? We can't set this in /etc/profile.d for various reasons, so this is the only way I know to resolve it, even though it will increase administrative overhead until the job is done. Was thinking I might could script it with a "if $USER $SHELL == /bin/tcsh then do timeout".


r/UnixProTips • • Feb 05 '15

comm - select or reject lines common to two files

8 Upvotes

If you have two sorted files you can slice on common lines in a few handy ways:

Lines only in file 1: comm -23 file1 file2
Lines only in file 2: comm -13 file1 file2
Lines that appear in both file 1 and file 2: comm -12 file1 file2

r/UnixProTips • • Feb 04 '15

Quickly solving Debian (or derivative) "file not found" errors during compilation.

8 Upvotes

If a compilation ever fails because of a missing file, simply install "apt-file" and do

apt-file search "filename"

and install the corresponding package. 99% of the time, this saves the need to troubleshoot the error on forums.

Another tip is to install and use "checkinstall" instead of "make && make install" - that way you can remove the installed package simply with

dpkg -r "package"

EDIT: formatting


r/UnixProTips • • Aug 03 '24

Fedora 40 how to install video codecs - RPM Fusion tutorial

Thumbnail
youtube.com
7 Upvotes

r/UnixProTips • • Jan 12 '21

Mods needed!

7 Upvotes

As I don't have time to moderate this subreddit and i hate to see people not being able to share what they want, I'm looking for someone to moderate this subreddit,

Just send me a dm if you're interested

Thanks


r/UnixProTips • • Feb 07 '15

Wait for a process to finish and do something

7 Upvotes

So you want to wait for a process to finish and say, turn off your computer

$ wait 419 && systemctl poweroff
-bash: wait: pid 419 is not a child of this shell

worry not, you can still do it by doing

while [ -e /proc/419 ]; do sleep 60; done && systemctl poweroff

where 419 is the pid of the process you are waiting for.

general usage definition would be

while [ -e /proc/<pid> ]; do sleep 60; done && <command>

which will sleep 60 seconds between checks.


r/UnixProTips • • Feb 03 '15

Quick & simple logging macro for bash scripts

7 Upvotes

Mostly just throwing this in here to help out a fledgling subreddit... Fly little subreddit, fly!

Anyway, I use this bit as a quick and simple log macro in a lot of my less robust bash scripts:

LOG="echo ["`basename $0`"] "

Usage:

$LOG"Log this message"
$LOG"And this one"
$LOG"And even this longer one thats also about nothing"

Result:

[script.sh] Log this message
[script.sh] And this one
[script.sh] And even this longer one thats also about nothing

The basename $0 bit returns the filename from the path you called. Then I just put it in brackets and echo that before the message. So calling my/project/bin/script.sh results in [script.sh].

Super simple, probably obvious, but I like that it only takes up one line but is sufficient for just about any small or one-off script. And it's portable!

Anyone use anything similar?


r/UnixProTips • • Feb 03 '15

bash function to get your remote ip

7 Upvotes

A simple function to retrieve your current remote ip.

get_ip() {
    page='http://myip.dnsomatic.com'

    which curl > /dev/null 2>&1
    if [ "$?" -eq "0" ]; then
            echo "ip: `curl -s $page`"
    else
            echo -e "curl is not installed, aborting"
    fi
}

r/UnixProTips • • May 19 '23

want a place to learn and share? see what ~vern is about

6 Upvotes

what is that?

~vern is an interactive community to learn about unix, the shell, internet protocols and much more. while it hosts a lot of services like privacy frontends or git hosting, it has a cozy community that always is there to help! if there's something you may be trying to do with a server, you could even use the pubnix available! ~vern is the greatest place to learn, communicate and discover linux! wanna see more?


r/UnixProTips • • Jan 18 '21

Distro Specific UPT of the day: In Emerge, Gentoo's package manager frontend, press [enter] instead of "y" to accept.

6 Upvotes

I wonder what other package managers have small tidbits like this?


r/UnixProTips • • Apr 15 '19

Is there a good way to add lyrics to music library?

6 Upvotes

I have huge library of music, but the music player I use, does not download synced lyrics it only downloads static lyrics. The developer added an option, upon request, to use a local .lrc file as the lyrics source. I cannot find any good website to download the synced lyrics and my music library is very big. I cannot go adding .lrc files for individual songs. Is there an easier way of doing this? may be a tool (CLI or otherwise) that can crawl through my music library and add .lrc files?


r/UnixProTips • • Feb 14 '15

[ZSH] List of ZSH frameworks, plugins & themes

6 Upvotes

I maintain a list of zsh frameworks, plugins, themes and completions at https://github.com/unixorn/awesome-zsh-plugins inspired by the various awesome-* lists.


r/UnixProTips • • Feb 08 '15

Alias .~= . ~/.bash_profile

6 Upvotes

Saves a ton of time when you are mucking around with setting environment variables and the like.


r/UnixProTips • • Feb 04 '15

history, !123 (run item 123 from your history)

6 Upvotes

r/UnixProTips • • Apr 01 '18

a custom Xfce xubuntu Install that takes 2 hours with script in video Description in 2017 | 48minutes duration

Thumbnail
youtube.com
5 Upvotes