alias cls=clear
My first language was QB, so it makes me chuckle.
Also, alias cim=vim
. If I had a penny...
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.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
alias cls=clear
My first language was QB, so it makes me chuckle.
Also, alias cim=vim
. If I had a penny...
I also have cls aliased to clear! I used to use windows terminal and found myself compulsively typing cls when I moved to linux.
Polls for potential zombie processes:
# Survive the apocalypse
function zombies () {
ps -elf | grep tsc | awk '{print $2}' | while read pid; do
lsof -p $pid | grep cwd | awk '{printf "%-20s ", $2; $1=""; print $9}'
done
}
export -f zombies
alias zeds="watch -c -e -n 1 zombies"
My desktop text editor has an autosave feature, but it only works after you've manually saved the file. All I wanted is something like the notes app on my phone, where I can jot down random thoughts without worrying about naming a new file. So here's the script behind my text editor shortcut, which creates a new text file in ~/.drafts, names it with the current date, adds a suffix if the file already exists, and finally opens the editor:
#!/bin/bash
name=/home/defacto/.drafts/"`date +"%Y%m%d"`"_text
if [[ -e "$name" || -L "$name" ]] ; then
i=1
while [[ -e "$name"_$i || -L "$name"_$i ]] ; do
let i++
done
name="$name"_$i
fi
touch -- "$name"
pluma "$name" #replace pluma with your editor of choice
alias scr=screen -dRU
I don't know why Screen has any other flags. I do not want to bother learning the keyboard shortcuts for tmux even though its probably works better
I have started my daily drawing journey which i still am bad at it. To create a new .kra files files every day I use this
#/usr/bin/bash
days=$(</var/home/monika/scripts/days)
echo "$days"
file_name=/var/home/monika/Pictures/Art/day$days.kra
if [ -f $file_name ]; then
echo file is present
else
if [[ $days%7 -eq 0 ]]; then
echo "Week completed"
fi
cp "/var/home/monika/scripts/duplicate.kra" $file_name
flatpak run org.kde.krita $file_name
echo $(($days + 1)) >/var/home/monika/scripts/days
fi
I've stolen a bunch of Git aliases from somewhere (I don't remember where), here are the ones I ended up using the most:
g=git
ga='git add'
gau='git add --update'
gcfu='git commit --fixup'
gc='git commit --verbose'
'gc!'='git commit --verbose --amend'
gcmsg='git commit --message'
gca='git com
gd='git diff'
gf='git fetch'
gl='git pull'
gst='git status'
gstall='git stash --all'
gstaa='git stash apply'
gp='git push'
'gpf!'='git push --force-with-lease'
grb='git rebase'
grba='git rebase --abort'
grbc='git rebase --continue'
I also often use
ls='eza'
md='mkdir -p'
mcd() { mkdir -p "$1" && cd "$1" }
And finally some Nix things:
b='nix build'
bf='nix build -f'
bb=nix build -f .'
s='nix shell'
sf='nix shell -f'
snp='nix shell np#'
d='nix develop'
df='nix develop -f'
This makes me want spacemacs for the terminal
# grep search the current directory
function lg() {
ls -alt | grep $1
}
ganis
:
git add -A && sudo nixos-rebuild switch --impure -j$(nproc)
Everyone who uses nixos probably has a similar alias set x)
Because using docker can sometimes cause ownership issues if not properly configured in your docker-compose.yml, I just added an alias to ~/.zshrc to rectify that.
-edit- Only run this script in your user owned directories, e.g. anything from ~/ (or /home/<your_username>) you might otherwise cause ownership issues for your system.
## Set ownership of files/folders recursively to current user
alias iownyou="sudo chown -R $USER:$GROUP"
I replaced rm with trash-put, just in case I realize I need some files that I removed down the line.
alias rm='trash-put'
Official author don't recommend it due to different semantics. But honestly for my own personal use case its fine for me.
Also I like to alias xclip:
alias clippy='xclip -selection clipboard'
# cat things.txt | clippy
I don't have anything too fancy. I use [theFuck(https://github.com/nvbn/thefuck) to handle typos, and I have some variables set to common directories that I use.
I have a few:
loginserver
dcompose(d/pull) - docker compose (down/pull)
3 scripts that are just docker compose up/down/pull, as scripts (remind me in 6 hours and I will post the scripts) so that it will CD to my compose folder, execute the command (with option for naming specific containers or blank for all) and then CD back to the directory I started in.
#Create predefined session with multiple tabs/panes (rss, bluetooth, docker...)
tmux-start
#Create predefined tmux session with ncmpcpp and ueberzug cover
music
#Comfort
ls = "ls --color=auto"
please = "sudo !!"
#Quick weather check
weatherH='curl -s "wttr.in/HomeCity?2QF"'
#Download Youtube playlist videos in separate directory indexed by video order in playlist -> lectures, etc
ytPlaylist='yt-dlp -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"'
#Download whole album -> podcasts primarily
ytAlbum='yt-dlp -x --audio-format mp3 --split-chapters --embed-thumbnail -o "chapter:%(section_title)s.%(ext)s"'
# download video -> extract audio -> show notification
ytm()
{
tsp yt-dlp -x --audio-format mp3 --no-playlist -P "~/Music/downloaded" $1 \
--exec "dunstify -i folder-download -t 3000 -r 2598 -u normal %(filepath)q"
}
# Provide list of optional packages which can be manually selected
pacmanOpts()
{
typeset -a os
for o in `expac -S '%o\n' $1`
do
read -p "Install ${o}? " r
[[ ${r,,} =~ ^y(|e|es)$ ]] && os+=( $o )
done
sudo pacman -S $1 ${os[@]}
}
# fkill - kill process
fkill() {
pid=$(ps -ef | sed 1d | fzf -m --ansi --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 40% --border=sharp --prompt="➤ " --pointer="➤ " --marker="➤ " | awk '{print $2}')
if [ "x$pid" != "x" ]
then
kill -${1:-9} $pid
fi
}
Similar to yours OP I copy many URLs and then run my script that takes the number of URLs I copied eg 5,and downloads them with yt-dlp
and GNU parallel
to ~/Videos
I use CopyQ to hold the clipboard history.
git() {
if [ "$1" = clone ]; then
shift
set -- clone --recursive "$@"
fi
command git "$@"
}
Is this just meant to make git clone always clone recursively?
Can't you do this with aliases in your .gitconfig?
Ooooh tmpv is a smart name for your little tool. I may steal it lol
Please do!
Currently using this to resize screenshots in a Word doc
#Requires AutoHotkey v2.0
^+1:: { Send "{RButton}z{Tab 3}4{Enter}" }
Technically not an alias, because I just use nushell's history + autocompletion everytime I use it, but one could alias it. I think I might even write a custom command for it, with path
argument, some day. Anyway, here it goes:
rsync -aPh -e "ssh -p 2222" test@172.16.0.86:/storage/emulated/0/PicturesArchive/ ~/PicturesArchive/
I run an ssh daemon on my phone, and use this snippet to back up my photos.
For me it's pretty basic. It's mostly aliases for nix related commands, like rebuild-switch, updating, garbage collecting, because those nix commands are pretty lenghty, especially with having to point to your flake and everything. I'm thinking of maybe adding an alias for cyanrip (cli cd ripper), because i recently ripped my entire cd collection, but going forward if i buy another cd every now and then, i'll probably end up forgetting about which flags i used.