Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Post your aliases en masse
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
szpko
n00b
n00b


Joined: 24 Apr 2014
Posts: 9

PostPosted: Sun Apr 27, 2014 2:20 am    Post subject: Post your aliases en masse Reply with quote

Collection 'en masse' rather than cherry-picked for a particular discussion.

de-sudoed as suggested...

Code:
# GENRAL SYSTEM ALIASES
alias ls='ls --color=auto'
alias ll='ls -lh'
alias lls='ls -alh'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'

# FREQUENTLY USED
alias worldup='cp /var/lib/portage/world $HOME/Backups/gentoo/packages/package-list.txt'

# APPLICATIONS
alias mountup='mount | column -t'
alias boxup='openbox --restart'
---

_________________
...


Last edited by szpko on Sun Apr 27, 2014 6:17 am; edited 2 times in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Apr 27, 2014 3:35 am    Post subject: Reply with quote

szpko ...

you do realise that /etc/bash/bashrc is also used for root shells? Also, 'eselect editor' sets the $EDITOR variable so 'nano' needn't be hardcoded. In general though the use of 'sudo' should come with warning, and in the above the root env path is not available so all the 'sudo what-have-you' will not not be in $PATH and, more importantly, have completion.

For things like 'nano /etc/portage/<foo>' aliases ... doesn't bash support hashed dirs?

Code:
% echo $SHELL
/bin/zsh
% hash -d portage=/etc/portage
% vim sudo:~p<tab>/m<tab>

... seems a lot more flexable than hardcoding.

best ... khay
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Apr 27, 2014 4:22 am    Post subject: Reply with quote

It's better to not use sudo at all, sudo increase security risk (even well use), it doesn't lower them.

And seeing your xcp alias, you really should remove sudo
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Apr 27, 2014 6:06 am    Post subject: Reply with quote

The first posting was edited, so maybe I am missing the context. However:
krinn wrote:
sudo increase security risk (even well use),

I would not say this is that generality: If you have well-picked scripts for which you allow sudo permissions, usage should be safe. Of course allowing everything to untrusted users by entering the password would be a wrong policy. (By definition, a user is untrusted if he uses a web browser - even if it is you).
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Sun Apr 27, 2014 1:03 pm    Post subject: Reply with quote

Code:
alias df='df --human-readable'
alias tree='tree --dirsfirst'

alias diff='colordiff'
alias grep='grep --color=auto'

alias ls='ls --color=auto'
alias ll='ls --color=auto -l'
alias la='ls --color=auto -a'

alias find='noglob find'

alias e='$EDITOR'
alias p='$PAGER'
alias x='exec'
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 139

PostPosted: Sun Apr 27, 2014 1:52 pm    Post subject: Reply with quote

Code:
14:33:55 jmmij@jjmach ~> grep alias .zshrc
alias e=xemacs
alias en='emacs -nw'
alias eq='e -q'
alias e4=xemacs4
alias rm='rm -vi'
alias rf='mv -t ~/.local/share/Trash/files'
alias rr='rm -r'
alias cp='cp -iv'
alias mv='mv -iv'
alias ls='ls --color=always'
alias ll='ls -lh'
alias la='ls -Ah'
alias lu='ls -luh'
alias lla='ll -Ai --author'
alias lal='lla'
alias lt='lla -t --author'
alias lth='lt | head -n 20'
alias luh='lt -u | head -n 20'
alias lch='lt -c | head -n 20'
alias lls='lla -S | head -n 20'
alias grep='grep --color=always'
alias bc="bc -l"
alias h=history
alias g=galeon
alias o='opera'
alias ff="firefox-bin"
alias m=more
alias l=less
alias les=less
alias lastn="last | grep -v $USER"
alias j='jobs -l'
alias k='kill -9'
alias rsync='rsync -e ssh -rltv'
alias fuw='ssh -X fuw'
alias wshell='ps -o comm -p $$ | tail -1'
alias wshell='echo $0'
alias pine=alpine

_________________
Vanitas vanitatum et omnia vanitas.
Libera temet ex inferis.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sun Apr 27, 2014 2:06 pm    Post subject: Reply with quote

Showing alias and computer informations is a security risk even in trusted environment.
_________________
Paul
Back to top
View user's profile Send private message
megabaks
Apprentice
Apprentice


Joined: 22 Jan 2012
Posts: 253
Location: Russia && Saint-Petersburg

PostPosted: Sun Apr 27, 2014 2:18 pm    Post subject: Reply with quote

Code:
alias bunzip2='lbunzip2 -n4'
alias bzip2='lbzip2 -n4'
alias ccal='grca cal'
alias cleanup='eclean-dist -d && eclean-pkg -d'
alias cvs='grca cvs'
alias df='grca df'
alias diff='grca diff'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias fix-system='python-updater -- -avD1 && perl-cleaner --all'
alias grca='grc --colour=auto'
alias grep='grep --colour=auto'
alias gunzip='unpigz -p4'
alias gzip='pigz -p4'
alias ifconfig='grca ifconfig'
alias iostat='grca iostat'
alias kernel-builder='sh /home/megabaks/scripts/kernel-builder/kernel-builder'
alias last='grca last'
alias ll='grca ls --color=force -l'
alias ls='ls --color=auto'
alias lsmod='grca lsmod'
alias make='grca make'
alias man='LC_ALL=ru_RU.UTF-8 man'
alias mc='/usr/bin/mc -b'
alias mcedit='/usr/bin/mcedit -b'
alias metadata='/home/megabaks/scripts/stuff/metadata'
alias mount='grca mount'
alias netstat='grca netstat'
alias ping='grca ping'
alias ps='grca ps'
alias route='grca route'
alias ssd='smartctl -a /dev/sda > /home/megabaks/ssd_state_`date +%y-%m-%d`'
alias traceroute='grca traceroute'
alias uname='grca uname'
alias uptime='grca uptime'
alias vmstat='grca vmstat'
alias whereis='grca whereis'
alias why-masked='sh /home/megabaks/scripts/portage/why_masked'
alias world-update='portconf -s && emerge -avuDN --keep-going=y world; smart-live-rebuild -- -avD1 --keep-going=y; revdep-rebuild -i; pfl;symlinks -dr /usr; sh /home/megabaks/scripts/portage/prelink-wrapper -amR;dkms-gentoo --db; emerge -ac'
alias xz='/usr/bin/pixz -p4'

_________________
sorry my bad english
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Apr 27, 2014 2:20 pm    Post subject: Reply with quote

hello ...

My .zshrc with aliases begining at line 321. The complete zsh dotfiles can be found here.

best ... khay
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Apr 28, 2014 6:02 am    Post subject: Reply with quote

mv wrote:
I would not say this is that generality

Without sudo you have a define security risk.
Adding sudo you add a tool that handle privilege to allow root action to be made, so you are adding a tool that by itself can grant privilege escalation if buggy.

So yes, adding sudo is just adding a security risk rather than like people think adding a tool to lower risk. Just like adding any other tool with that purpose would add another risk.
I'm not saying sudo doesn't have benefits, some admin might need to delegate tasks to other trust user, that's fine. But they know they add security risk to balance they couldn't themselves handle all risks. So it's a win/win : i add sudo that add another risk but by using sudo i remove some risks as my trust users are helping me.

So admin without multi-account users should just never use sudo, as they add a security risk to balance their own usage of root account.
That's really really bad : someone log as root cannot easy forget he is root and should take special care of his action ; while using sudo, and specially with alias, you just abstract the risk.
And you get stupid security risk like that user that provide "xcp sudo cp -r". If then his sudo user account is broken, anyone can cp using root privilege...
It's even contrary to sudo usage to protect yourself from stupid root action. You're doing copy with root privilege allowing a mis-usage of xcp to strike the system.

Any tasks given to your sudo user is allow to someone that broke into that user account... While without sudo, root account remain to be broken. So if your root account is a weakness, with sudo your root account still is a weakness but other sudo user add another weakness.

So yes, i could generally speaking affirm that using sudo is a security risk. Like i said, even when sudo is well use. But when not well use, it's a misery.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Apr 28, 2014 3:51 pm    Post subject: Reply with quote

krinn wrote:
So yes, adding sudo is just adding a security risk rather than like people think adding a tool to lower risk

In this sense you are right. But to be fair one should say that in practice for some tasks you only have the alternative to use sudo or some other tool to raise privileges (e.g. su, polkit, or even just some SUID or GUID binary like mount). In this comparison, sudo is in several cases the more secure solution (e.g. if you use it to drop polkit, or in some exceptional situations also when you use it to remove a SUID/GUID privilege.) In the particular examples you are right, of course (this is where I did not know the context; meanwhile the context was restored)
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Tue Apr 29, 2014 10:20 am    Post subject: Reply with quote

Here are mine, and I see that alias list is rather slim.
Code:
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias grep='grep --colour=auto'
alias l='ls -lh'
alias ll='l -a'
alias ls='ls --color=auto'
alias sqlplus='rlwrap sqlplus'

_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Tue Apr 29, 2014 11:14 am    Post subject: Reply with quote

I don't use aliases.
aliasing for aliasing... I prefer to bind -m emacs ... ...
_________________
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue Apr 29, 2014 11:59 am    Post subject: Reply with quote

Logicien wrote:
Showing alias and computer informations is a security risk even in trusted environment.

Not at all. man "security by obscurity"
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue Apr 29, 2014 12:35 pm    Post subject: Reply with quote

Yamakuzure wrote:
Code:
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias grep='grep --colour=auto'

I prefer instead:
Code:
export GREP_OPTIONS=--color=auto GREP_COLOR='1;33'
Here are a few others (I selected only those which I really use frequently):
Code:
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias -- +='pushd .' # (unused; I use instead setopt autopushd in zsh)
alias -- -='popd'
alias '~=cd ~-'
# ":A" to store current directory in ${A}, "A:" to restore it
# (it is intentional that the latter reminds on msdos...):
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
do   alias ${i}:="cd -- \"\${${i}}\""
   alias :${i}="${i}=\${PWD}"
done
alias which='type -a'
alias ls.bare='command ls --color=auto'
alias ls='ls.bare -X'
alias l='ls -lA'
alias ll='l --full-time'
alias lt='ls.bare -lA --sort=time --full-time --no-group'
# Not an alias, and it conflicts with mtools. However:
mcd() {
   mkdir -- "${1}" && cd -- "${1}"
}
alias rsync.bare='sshstart; command rsync -XltDHS -Pi --modify-window=1'
alias rsynci.bare='sshstart; command rsync -XltDHW -Pi --modify-window=1 --inplace'
alias rsync='rsync.bare -p'
alias rsynci='rsynci.bare -p'
alias rsyncp='rsync -go'
alias rsyncpi='rsynci -go'
alias rsynca='rsyncp -r --delete'
alias rsyncai='rsyncpi -r --delete'

I am not happy about the rsync stuff based on mnemonics which make sense to me (actually I have much more of these), but have not yet an idea for a better approach.
And then there are of course some zsh inline aliases
Code:
alias -g 'CAT'='|& cat -A'
alias -g 'TAIL'='|& tail -n $(( $LINES - 3 ))'
alias -g 'LESS'='|& less -Rs'
alias -g 'NUL'='>/dev/null'
alias -g 'NULL'='NUL'
alias -g 'NIL'='>&/dev/null'
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Wed Apr 30, 2014 7:23 am    Post subject: Reply with quote

mv wrote:
Yamakuzure wrote:
Code:
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias grep='grep --colour=auto'

I prefer instead:
Code:
export GREP_OPTIONS=--color=auto GREP_COLOR='1;33'
Thanks for the hint. I have to admit, that I carry those aliases around since 2003. ;-)
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Apr 30, 2014 10:34 am    Post subject: Reply with quote

mv wrote:
I prefer instead:
Code:
export GREP_OPTIONS=--color=auto GREP_COLOR='1;33'

mv, Yamakuzure, et al ...

I have ...

~/.zprofile
Code:
export GREP_COLOR='00;38;5;226'
export GREP_OPTIONS="--color=auto \
 --directories=skip \
 --binary-files=without-match \
 --exclude=\*.swp \
 --exclude=\*.pyc \
 --exclude=\*.zwc\* \
 --exclude=.zcompdump\* \
 --exclude-dir=.git \
 --exclude-dir=.svn"

best ... khay
Back to top
View user's profile Send private message
Polyatomic
n00b
n00b


Joined: 18 May 2014
Posts: 36

PostPosted: Sun Aug 10, 2014 8:57 am    Post subject: Reply with quote

khayyam wrote:
hello ...

My .zshrc with aliases begining at line 321. The complete zsh dotfiles can be found here.

best ... khay


Nice one khayyam
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Aug 10, 2014 10:54 am    Post subject: Reply with quote

Polyatomic wrote:
khayyam wrote:
hello ...

My .zshrc with aliases begining at line 321. The complete zsh dotfiles can be found here.

best ... khay


Nice one khayyam

It seems that the posting you are replying to is gone!!?

khayyam, these are indeed nice dotfiles. Is there a reason that quite some aliases start with a space?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Aug 10, 2014 1:01 pm    Post subject: Reply with quote

mv wrote:
khayyam, these are indeed nice dotfiles. Is there a reason that quite some aliases start with a space?

mv ... 'hist_ignore_space' is set so with the space these commands never end up in history.

best ... khay
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Aug 10, 2014 1:26 pm    Post subject: Reply with quote

khayyam wrote:
hist_ignore_space' is set

Thanks. I didn't expect that this works over aliases; I had tried before asking but did not realize in this experiment that the very last command can be revoked even if it starts with a space.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Aug 14, 2014 2:41 pm    Post subject: Reply with quote

I mostly have git aliases in my ~/.bashrc:
Code:
# console shortcuts
alias bashrc='source ~/.bashrc'
if [[ $DISPLAY ]]; then
   edit(){
      xdg-open "$@"
   }
else
   edit(){
      ${EDITOR:-nano -w} "$@"
   }
fi
alias ebashrc='edit ~/.bashrc'
# git
alias status='git status'
alias branch='git branch'
alias vbranch='git branch -lvv'
alias co='git checkout'
alias add='git add'
alias unadd='git reset HEAD'
alias gdiff='git diff'
alias staged='git diff --staged'
alias vdiff='git difftool -y'
alias vstaged='git difftool -y --staged'
alias ddiff='git difftool -d --no-symlinks'
alias commit='git commit'
alias merge='git merge --ff-only'
alias pull='git remote update -p; git merge --ff-only @{u}'
alias lol='git log --oneline --graph --decorate --all'
alias view='gitview --all 2>/dev/null &'

The difftool ones are for use with kdiff3; git config diff.tool. I use ebashrc to make quick edits to my bashrc, which I then reload with bashrc.

Yes I know about git aliases, but I don't like them half as much; the whole point for me is to have quick access to what I use most.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum