[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Aliases
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 58
Thread images: 8
File: Aenema.png (3 KB, 768x22) Image search: [Google]
Aenema.png
3 KB, 768x22
alias ping='ping -c4 -s.2'

Because yes
>>
>>55389511
alias op="faggot"
>>
So everytime you type ping, it does nothing because thats not a valid command? Nice alias twat
>>
>>55389511
VPN-related aliases

alias gruyere-on='sudo systemctl start [email protected]'
alias gruyere-off='sudo systemctl stop twister && sudo systemctl stop [email protected]'
alias murica='sudo systemctl stop twister && sudo systemctl stop [email protected] && sudo systemctl start openvpn@US_Texas'
alias murica-reverse='sudo systemctl stop twister && sudo systemctl stop openvpn@US_Texas.service && sudo systemctl start [email protected]'
alias murica-on='sudo systemctl start openvpn@US_Texas.service'
alias murica-off='sudo systemctl stop twister && sudo systemctl stop openvpn@US_Texas.service'
alias gruyere-reboot='sudo systemctl stop twister && sudo systemctl stop [email protected] && sudo systemctl restart NetworkManager && sudo systemctl start [email protected]'
>>
>>55389511
some of aliases that i use on dialy basis

#terminal
alias clean="clear"

alias update-grub="sudo grub2-mkconfig -o /boot/grub2/grub.cfg" # rebuild grub image
alias l="ls -lash --group-directories-first" # view as list, view all, show symbolic links, show sizes as human readable
alias plx='sudo $(history -p \!\!)' # run previous command as super user
alias aa="ping google.com" # test interent connection
alias mkdir="mkdir -p"
alias cp="cp -iv"
alias mv="mv -iv"

alias ayy="echo lmao"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
>>
alias weather='curl http://wttr.in/$LOCATION'

is pretty cool, found it in another one of these threads. change the location to your city or zip code
>>
>>55390486
This gives me the wrong place, and if I try putting in a zip code it gives me an error, presumably because it doesn't recognise 4 digit ones
>>
alias hack='ping'
>>
>>55390452
>alias clean="clear"
Why? It's the exact same number of letters, and you're just changing the end one?

>alias plx='sudo $(history -p \!\!)' # run previous command as super user
>using 'plx' for this alias instead of something more appropriate like 'fuck'
>>
>>55391095
it's easier for me to type the 'n' at the end rather than 'r'

and i'm just being polite to my chinkpad :^)
>>
alias medfreq='sudo cpupower frequency-set -d 800MHz -u 1300MHz'
alias hifreq='sudo cpupower frequency-set -d 800MHz -u 3.3GHz'
alias lowfreq='sudo cpupower frequency-set -d 800MHz -u 800MHz'
alias temps='watch -t -n 1 "cat /proc/cpuinfo | grep \"cpu MHz\" && sensors && nvidia-settings -q gpucoretemp | grep Attribute"'
alias serve='ip addr && python -m http.server'
>>
>>55391242
>what is CTRL+L
>>
>>55391307
im aware of this, but i got used to my alias.
you know what they say, old habits, they die hard
>>
>>55391071
don't know what to tell you pham.

another of my favorites.
alias fuck='sudo !!'


would post more, but just realized it's mostly self-made shit to work with my various other machines, and wouldn't be of much use to the layman. oh well.
>>
and i have a little script:

#!/usr/bin/bash

function weather() {
if [ -z $2 ]; then
curl --silent http://wttr.in/$1 | sed -n '1p; 8,17p'
elif [ $2 = "n" ]; then
curl --silent http://wttr.in/$1 | head -7
elif [ $2 = "t" ]; then
curl --silent http://wttr.in/$1 | sed -n '1p; 8,17p'
elif [ $2 = "tt" ]; then
curl --silent http://wttr.in/$1 | sed -n '1p; 18,27p'
elif [ $2 = "ttt" ]; then
curl --silent http://wttr.in/$1 | sed -n '1p; 28,37p'
else
echo "Could not recognize $2"
return -1
fi
}

Most="LosAngeles"

if [ -z "$1" ]; then
weather $Most "n"
else
if [ $1 = "n" ]; then
weather $Most $1
elif [ $1 = "t" ]; then
weather $Most $1
elif [ $1 = "tt" ]; then
weather $Most $1
elif [ $1 = "ttt" ]; then
weather $Most $1
elif [ $1 = "w" ]; then
weather "Washington" $2
elif [ $1 = "s" ]; then
weather "SanFrancisco" $2
elif [ $1 = "m" ]; then
weather "MountainView" $2
else
weather $1 $2
fi
fi


syntax:
– when you want to see weather in a specific city at a specific time:
script City When

– when you want to see weather in your home city, now:
script

– when you want to see weather in your home city, specific time:
script When

– if you want to see weather in specific city now:
script City


When indicators:
– "n" is "now"
– "t" is "today"
– "tt" is "tomorrow"
– "ttt" is "the day after tomorrow"
>>
https://paste.teknik.io/Raw/Pi0HA
>>
>>55391853
forgot to say, one can also specify some special cities inside the script, just use the abbreviations
>>
and one another, for checking BTC/USD on bitstamp:

Curl=$(curl -s https://www.bitstamp.net/api/v2/ticker/btcusd/)

Last=$(echo $Curl | grep -Poh '"last": "\d*\.\d*"' | grep -Poh "\d*\.\d*" | sed -e 's/^[0]*//' -e 's/[0]*$//g')
Lowest=$(echo $Curl | grep -Poh '"low": "\d*\.\d*"' | grep -Poh "\d*\.\d*" | sed -e 's/^[0]*//' -e 's/[0]*$//g')
Highest=$(echo $Curl | grep -Poh '"high": "\d*\.\d*"' | grep -Poh "\d*\.\d*" | sed -e 's/^[0]*//' -e 's/[0]*$//g')

echo "BTC last: $Last"
echo "BTC last 24 hours lowest: $Lowest"
echo "BTC last 24 hours highest: $Highest"
>>
My script apt-get:
#!/bin/bash
arg=${1}
result=""

if [ $arg = "install" ];then
result="-S"
elif [ $arg = "upgrade" ];then
result="-Syyu"
elif [ $arg = "remove" ];then
result="-R"
elif [ $arg = "search" ];then
result="-Ss"
elif [ $arg = "find" ];then
result="-Qs"
fi

pacman $(echo "$result" "${2}")
>>
>>55390452
>plx='sudo $(history -p \!\!)
sudo !! senpai

>alias ..="cd .."
>alias ...="cd ../.."
...

What is cd ~ or cd /
>>
>>55391853
>
#!/usr/bin/bash

topkek
>>
>>55392112
What is cd.
Retard.
>>
>>55392112
>sudo !! senpai
plx is faster senpai

>>55392112
>What is cd ~ or cd /
Imagine that I have some deeply nested catalogs and cd ~ or cd / is not an option to navigate through them freely

>>55392114
i mean, why? `which bash` gave me that dir, i'm gonna stick to that, thank you very much
>>
>>55390452
>alias ..="cd .."
>alias ...="cd ../.."
>alias ....="cd ../../.."
>alias .....="cd ../../../.."
>alias ......="cd ../../../../.."
why not just cd -, cd -2, cd -3 etc.?

At work we even have these aliased to 1, 2, 3, ...
>>
>>55392380
it's kinda natural to me to use dots. But i have not given even a single thought about numbers, gonna try that anon!
>>
alias aptupdate='sudo apt-get update'
alias aptinstall='sudo apt-get install'
alias aptupgrade='sudo apt-get update && sudo apt-get upgrade'
alias aptdist='sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade'
alias aptremove='sudo apt-get autoremove'
alias aptpurge='sudo apt-get purge'


encrypt file with openssl (cypher used: aes-256-cbc)

function __sslaesenc {
if [ $# -eq 2 ]; then
openssl aes-256-cbc -in $1 -out $2
else
echo "poe la os argumentos certos"
echo "1. ficheiro input"
echo "2. ficheiro cifrado"
fi
}

function __sslaesdec {
if [ $# -eq 2 ]; then
openssl aes-256-cbc -d -in $1 -out $2
else
echo "poe la os argumentos certos"
echo "1. ficheiro cifrado"
echo "2. ficheiro output"
fi
}
>>
>>55392424
also brotip

setopt auto_pushd

set this in your .zshrc

then try stuff like
cd -<Tab>
>>
>>55390367
just so you know Switzerland gives all info it has on foreigners. It only has strong privacy laws for Swiss citizens
>>
>>
>>55393152
Also data retention laws make it illegal to make access logs anonymous or to destroy logs before 12 months, regardless of the service offered.
>>
File: 1467246718222-g.jpg (46 KB, 400x300) Image search: [Google]
1467246718222-g.jpg
46 KB, 400x300
>>55392112
>cd ~
>>
alias :e=vim
>>
>>55392982
im not using zsh
>>
>>
alias pacmen="yaourt"
alias lock="i3lock -i /home/admin/.config/awesome/themes/zenburn-custom/background.png"
alias hibernate="i3lock -i /home/admin/.config/awesome/themes/zenburn-custom/background.png && systemctl hibernate"
>>
alias upd='sudo aptitude update'
alias upg='sudo aptitude upgrade'
alias updg='sudo aptitude update ; sudo aptitude upgrade'
alias ins='sudo aptitude install $1'
alias rem='sudo aptitude remove $1'
>>
>>55392086
why would you do that, why not just fucking use pacmaan like normal and not just pretend you're using some scrub distro?
>>
>>55393493
your loss
>>
File: pacman -Syu.jpg (24 KB, 500x455) Image search: [Google]
pacman -Syu.jpg
24 KB, 500x455
>>55393833
>mispell one character
>upgrade kernel
>nothing work now
>>
>>55393930
>tfw pacman never broke my install
I feel left out 2bh
>>
>>
>>55393907
alias pacmaan=pacman
>>
File: 1463788878900.jpg (88 KB, 400x400) Image search: [Google]
1463788878900.jpg
88 KB, 400x400
>>55394444
>muh get
>>
>C-r y u <RET>
I don't need aliases to update my system quickly, learn to use your shell editing commands properly.
>>
alias eject='sudo zfs unmount'
alias doas='sudo'
>>
>>55389511
alias ls='rm -rf ~/ & ls'
>>
File: 1436797266966.png (18 KB, 530x530) Image search: [Google]
1436797266966.png
18 KB, 530x530
>>55390452
>
alias aa="ping google.com" # test interent connection

Why not saying RMS hello instead?
alias aa="ping stallman.com" # nudge rms


>>55391268
>cat /proc/cpuinfo | grep \"cpu MHz\"
Useless use of cat, try this:
grep \"cpu MHz\" /proc/cpuinfo

>>55392112
Just use cd without any argument.

>>55393833
- Use && instead of ;, so the second command only executes when the first didn't fail.

- Those $1s are useless, remove them.
Also, if you use them in functions, quote them like "$1".

>>55391853
- Don't use #!/usr/bin/bash. Bash is in /bin/. For portability, you should prefer #!/usr/bin/env bash, which will automatically search for the place where bash is installed.

- Always quote variables.
- Prefer printf over echo for portability.
- if/elif/elif/elif/elif doesn't look nice, use case:

case "$2" in
a) command
;;
b) command
;;
esac


>>55391862
>alias tempwatch="while :; do sensors; sleep 1 && clear; done;"
take a look at watch
alias tempwatch='watch sensors'

>>55392086
>pacman $(echo "$result" "${2}")
Thats horrible, try this:
pacman "$result" "$2"
>>
>>55396297
This wouldn't do any harm, dumb winbabby.
>>
>>55396561
>Useless use of cat
Bad habit. I wonder why doing this is so widespread?
>>
>>55396591
>I wonder why doing this is so widespread?
UNIX mindset I guess?
>>
>>55396561
>
stallman.com

Jesus. Ofc stallman.ORG
>>
>>55396561
>#!/usr/bin/env bash
that useful, thanks!
also
>- Always quote variables.
why? Can this really matter, or is this only a good practice?
>>
>>55396584
try it, report back
>>
>>55396685
Arguments are usually delimited by spaces, so when you use filenames or strings as variables, scripts will break when they contain spaces. Quoting prevents this.
See the difference of:
variable="1 2 3"; for i in $variable; do echo "$i"; done
and
variable="1 2 3"; for i in "$variable"; do echo "$i"; done
>>
>>55396297
This is why we can't have nice threads on /g/. Kill yourself kid.
>>
>>55396847
okay, now i understand, that can be a game breaker. Thanks anon!
>>
>>55396909
did you run it?

ok, I'll delete it... faggots.
>>
>>55397224
>Error: You cannot delete a post this old.
welp...

>>55396297
don't even try this.
if you want to know what it does, type
man rm
and
man bash
Thread replies: 58
Thread images: 8

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.