您认为哪些别名对您的 Ubuntu 体验最有用或最有帮助?

您认为哪些别名对您的 Ubuntu 体验最有用或最有帮助?

自从第一次成为 Ubuntu 用户以来,我已经开发了一个越来越多的别名列表,有些别名我无法想象没有它们会怎样。这让我想到,可能还有大量我还没有想到要使用的别名,它们可以让我和其他 Ubuntu 用户的生活更轻松。

你们都用过哪些别名:
通用别名 - 适用于很多用户;
实用别名 - 你经常使用它们,或者当你使用它们时,它们可以节省很多时间

答案1

以下是一些我喜欢的:

#Opens current directory in a file explorer
alias explore='nautilus .'

#Opens current directory in a file explorer with super user privileges
alias suexplore='sudo nautilus .'

#Opens current directory in Ubuntu's Disk Usage Analyzer GUI with super user privileges in the background
alias analyze='gksudo baobab . &'

#Opens a GUI text editor in the background. Can obviously be replaced with your favorite editor
alias text='gedit &'
#Same as above with super user privileges
alias sutext='gksudo gedit &'

#Opens a file with whatever program would open by double clicking on it in a GUI file explorer
#Usage: try someDocument.doc
alias try='gnome-open'

#lists contents of current directory with file permisions
alias ll='ls -l -sort'

#list all directories in current directories
alias ldir='ls -l | grep ^d'

#self explanatory
alias ..='cd ..'
alias ...='cd ../../'

#show aliases
alias a='echo "------------Your aliases------------";alias'
#Apply changes to aliases
alias sa='source ~/.bash_aliases;echo "Bash aliases sourced."'
#Edit Aliases
alias via='gksudo gedit ~/.bash_aliases &'

答案2

这些是我喜欢的别名:

alias ll='ls -lAbhc'
alias l='ls -lBohc'

#History search (use: hs sometext)
alias hs='history | grep $1'

#Sudo vim
alias svim='sudo vim'

#Add extra protection against mistakes
alias rm='rm -I'

#Unrar alias
alias unrar='rar e'

答案3

我最常用的别名:

alias go=gnome-open

答案4

以下是我从这个 github 项目中收集的:https://github.com/roubles/bash_aliases

###############################################################################
##
## Essentials
alias rm="rm -i" # Confrim remove

###############################################################################
##
## ls variations
alias la="ls -AF"                   # List all files
alias ld="ls -d */"                 # List only directories
alias l.="ls -A | egrep '^\.'"      # List only dotfiles (hidden files)
alias l1='ls -1AF'                  # List files (one line at a time)
alias ll="ls -lhAF"                 # List all file details
alias lg="ls -AF | grep"            # Grep through filenames (also see, hg)
alias lp="ls -d `pwd`/*"            # List full paths
alias lpg="ls -d `pwd`/* | grep"    # Grep through filenames but list full path
alias lt="ls -Alt"                  # Sort by time
alias ltr="ls -Altr"                # Sort by time (reverse)
alias lss="ls -AFlS"                # Sort by size
alias lsr="ls -AFlSr"               # Sort by size (reverse)

###############################################################################
##
#typos
alias vi="vim"
alias vmi="vim"
alias sl="ls"
alias pdw="pwd"

###############################################################################
##
#tar
alias tarc="tar czvf"
alias tarx="tar xzvf"
alias tart="tar tzvf"

###############################################################################
##
#history
alias hg='history | grep'

###############################################################################
##
#chmod
alias ax="chmod a+x"

###############################################################################
##
# Jump down
alias 1d="cd .."
alias 2d="cd ..;cd .."
alias 3d="cd ..;cd ..;cd .."
alias 4d="cd ..;cd ..;cd ..;cd .."
alias 5d="cd ..;cd ..;cd ..;cd ..;cd .."

###############################################################################
##
# Jump down (reverse)
alias 1up='cd /$(echo $PWD | cut -f 2 -d /)'
alias 2up='cd /$(echo $PWD | cut -f 2,3 -d /)'
alias 3up='cd /$(echo $PWD | cut -f 2,3,4 -d /)'
alias 4up='cd /$(echo $PWD | cut -f 2,3,4,5 -d /)'
alias 5up='cd /$(echo $PWD | cut -f 2,3,4,5,6 -d /)'

相关内容