fish for the win. Used to be a bash zealot, but I haven’t found anything that beats fish’s autocomplete, it really saved my fingers. Plus oh-my-fish is wonderful. I still always use sh/bash for writing shell scripts though.
Edit : I neglected to mention how I configure it : Aside from oh-my-fish, I don’t. Minimalism for the win!
In .bashrc, four or five unexciting aliases required to make apt and go work properly because of “some quirks”, an extra PATH, and two conditionals to configure opam and emacs depending on the host (since I’m using the same .bashrc on all my machines). The only “exciting” bit I guess is a nice, pink PS1. Other than that, whatever came with Ubuntu I think.
In tmux.conf, I set the right status bar to show the time in an ISO-8601-like format that makes sense to me and is easy for me to parse. I also set the status bar foreground colour to (once again) my favourite pink.
A command to put the tmux copy buffer into the OS clipboard, and some easier window navigation/swapping with shift+arrows.
set -g status-interval 1
set -g status-right "#(tmux-clock.sh PRC) "
set -g status-bg colour218
set -g message-bg black
set -g message-fg colour218
bind C-v run-shell "tmux show-buffer | xclip -sel clip -i 1> /dev/null 2> /dev/null" \; display-message "Copied tmux buffer to the system clipboard"
bind -n S-Left previous-window
bind -n S-Right next-window
bind -n S-Up swap-window -t -1
bind -n S-Down swap-window -t +1
I mainly use bash as a wrapper for emacs where the bulk of my configuration lies, but even then my .emacs just barely breaks 200 lines. I’ll save that bit for a different thread, in a different time.
I like the minimalism. Less stuff that can break, and I will not be utterly confused every time I sit in front of a different computer.
I use bash together with the config found in my emacs/config repo. Can’t say that I’ve explored all that much, bash works well enough for my needs so far
Joking aside: currently still bash, maybe moving to zsh because its the default on Macs but
For shell scripts I strictly use Posix sh. Really hate shell scripts in other shells or with Linuxisms (another kind of plague we have to deal with nowadays since Linux became the new shitty but everyone uses it OS)
The only other configuration I have is auto-completion support for git.
zsh seems to have built in auto-completion of git commands, so I don’t have to configure that. On the other hand, to complete git commands zsh often require me to type a space where bash would insert the space. Also it seems that zsh don’t cleans up terminal settings when Erlang crashes. For those reasons I still like bash better and have not migrated to zsh on my main computer despite macOS nagging me to do so:
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
I use ZSH and my .zshrc is becoming unwieldy at a thousand lines now. It probably needs a bit of a spring clean but here’s some of what I’ve got:
#PS1="[\W]\$ "
PROMPT='%c$ '
alias ll="ls -lahG"
alias irbs="irb --simple-prompt"
alias rake="bundle exec rake"
alias pow="touch tmp/restart.txt"
alias find-rails-pid="lsof -wni tcp:3000"
alias gp="git push"
alias gcu="git commit -am 'update'"
alias mixec="mix ecto.create"
alias mixem="mix ecto.migrate"
alias mixps="mix phx.server"
alias iexmixps="iex -S mix phx.server"
alias iexsmix="iex -S mix"
alias iexs="iex -S mix"
alias mixpr="mix phx.routes"
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias flushdns="sudo killall -HUP mDNSResponder; say dns cleared successfully"
#^^ I should add more 'says' in this file!! haha!
alias pgstart="brew services start postgresql"
alias pgrestart="brew services restart postgresql"
alias pgstop="brew services stop postgresql"
alias pgreset="rm /usr/local/var/postgres/postmaster.pid"
alias projects="cd /Users/Aston/projects"
alias notes="cd /Users/Aston/Notes"
alias c="cd /Users/Aston/projects/code"
alias h="cd /Users/Aston"
alias oss="cd /Users/Aston/projects/oss"
alias desk="cd /Users/Aston/desktop"
alias reload=". ~/.zshrc"
alias profile="mate ~/.zshrc"
alias p="profile"
alias dt="cd /Users/Aston/projects/code/devtalk"
# One for each site/project^^
alias server_name="ssh root@$NAME_OF_SERVER -p XXXXXXXX"
# One for each server^^
alias screengrab-jpg="defaults write com.apple.screencapture type jpg"
alias screengrab-png="defaults write com.apple.screencapture type png"
alias showhidden="defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder"
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder"
export GEM_EDITOR='mate'
I also have a large number of functions that carry out tasks, such as for uploading or downloading files or folders to a server, downloading certain types of backups, etc. The biggest of these is probably for pushing sites to a production server, which does things like ssh to server, put site in maintenance mode, upload files, run migrations, restart server and then take the site out of maintenance mode. I have a main push function that calls other push_functions depending on what the site is or what type of site it is. I much prefer this to using something like Capistrano.
I did this when macOS made it the default… and I basically just copied my .bash_profile file over to .zshrc and everything just worked as normal
I have an external aliasrc file which I source so I don’t clutter my .zshrc
Aliases are POSIX compliant too so it’s a nice way to separate zsh-specific things from shell-agnostic ones
edit: also you can separate your export's to a .zshenv file which you can source from your .zprofile
I’m using tcsh and rely more on command history than aliases
Approach has some minor issues - for example when history is lost,
unavailable or filled with rubbish, but I can live with that.
I’ve been procrastinating migration to something “modern” for some years ;-).
I often start shell from Emacs, so I can interact with terminal as in Emacs.
In particular:
navigate in buffer without a mouse
easily reset terminal content
I have some searching shortcuts - so if I start typing and press arrow up/down I can iterate over
commands starting with what I’ve entered so far.
bindkey -k down history-search-forward
bindkey -k up history-search-backward
bindkey ^p history-search-backward
bindkey ^n history-search-forward
Following aliases are most important for me
alias ht 'history|tail -20'
alias g 'grep --colour'
alias h 'history'
alias f 'find `pwd` -name '
alias e 'emacsclient -t -create-frame --alternate-editor=""'
alias x 'xargs'
Above allows following:
h | g push
<execute wanted command with !Number>
It is not very easy to have oneline loops in tcsh, but recently
I’ve learned about repeat command which solves the problem.
ZSH has the same capability except much more easily extensible!
No that’s just standard command completion
That’s configureable. ^.^
That’s generally handled by the prompt, the default prompt (including even in bash unless your distro changes it) doesn’t do those things as it breaks expectations of some things. I use starship.rs for my prompt (it’s a full fast powerline).
Was just about to post a poll for this (and to mention a new shell called ‘Dagger’) but noticed we already have a thread so have added a poll to the first post and moved the thread to our Wikis, Polls & Dev Envs > Polls section
bash interactively. For scripts I try to stick to POSIX sh. Customisation is basically setting LANG, PATH, and MANPATH plus turning off colourising and ensuring that prompts do not contain full path names (because I’d like some of the command line left for me to type in). Then there’s whatever opam dumps in there.