112
submitted 18 hours ago by als@lemmy.blahaj.zone to c/linux@lemmy.ml

A while ago I made a tiny function in my ~/.zshrc to download a video from the link in my clipboard. I use this nearly every day to share videos with people without forcing them to watch it on whatever site I found it. What's a script/alias that you use a lot?

# Download clipboard to tmp with yt-dlp
tmpv() {
  cd /tmp/ && yt-dlp "$(wl-paste)"
}
you are viewing a single comment's thread
view the rest of the comments
[-] danielquinn@lemmy.ca 5 points 12 hours ago

I have a few interesting ones.

Download a video:

alias yt="yt-dlp -o '%(title)s-%(id)s.%(ext)s' "

Execute the previous command as root:

alias please='sudo $(fc -n -l -1)'

Delete all the Docker things. I do this surprisingly often:

alias docker-nuke="docker system prune --all --volumes --force"

This is a handy one for detecting a hard link

function is-hardlink {
  count=$(stat -c %h -- "${1}")
  if [ "${count}" -gt 1 ]; then
    echo "Yes.  There are ${count} links to this file."
  else
    echo "Nope.  This file is unique."
  fi
}

I run this one pretty much every day. Regardless of the distro I'm using, it Updates All The Things:

function up {
  if [[ $(command -v yay) ]]; then
    yay -Syu --noconfirm
    yay -Yc --noconfirm
  elif [[ $(command -v apt) ]]; then
    sudo apt update
    sudo apt upgrade -y
    sudo apt autoremove -y
  fi
  flatpak update --assumeyes
  flatpak remove --unused --assumeyes
}

I maintain an aliases file in GitLab with all the stuff I have in my environment if anyone is curious.

[-] golden_zealot@lemmy.ml 10 points 10 hours ago

Execute the previous command as root

Fun fact if you are using bash, !! will evaluate to the previous command, so if you miss sudo on some long command, you can also just do sudo !!.

[-] jwt@programming.dev 2 points 4 hours ago

With the added benefit of it looking like you're yelling at your prompt in order to get it to use sudo.

this post was submitted on 23 Jun 2025
112 points (99.1% liked)

Linux

55556 readers
1116 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS