DEV Community

Cover image for Customize Fish Shell
vasubabu
vasubabu

Posted on • Edited on

Customize Fish Shell

Recently I got a chance to taste the fish and I must say it's awesome even though I am totally into bash till now. This Fish Shell is a fully-equipped command line shell that is smart and user-friendly.

There are multiple reasons to say that it is the best tool and some of them are:

  • Intelligent Auto Suggestions
  • Themes support
  • Scripting support - Let's talk about it more!!!

You can find a hell number of articles about this, but I wanted to stress more on customizing your existing Fish shell.

One of my biggest questions when I initially started using Fish was how to migrate my existing bash profile to Fish Shell?.

The answer is Fairly Simple - Easy peasy!!!

~/bash_profile:

alias idea='open -a "`ls -dt /Applications/GoLand.app|head -1`"'
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home

function .runElasticSearch() {
  docker run -p 9200:9200 -p 9300:9300 --name elastic -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.4.0

docker run --link elastic:elasticsearch -p 5601:5601 {docker-repo}:{version}

}

function .runZookeeper() {
  cd /Users/vasubabujinagam/Documents/softwares/zookeeper/bin
  ./zkServer.sh start
}

function .stopZookeeper() {
   cd /Users/vasubabujinagam/Documents/softwares/zookeeper/bin
  ./zkServer.sh stop
}

function .runKafka() {
  cd /Users/vasubabujinagam/Documents/softwares/kafka_2.11
  ./bin/kafka-server-start.sh config/server.properties
}

This is how fish functions looks like:

Fish: ~/.config/fish/config.fish

alias idea='open -a "`ls -dt /Applications/GoLand.app|head -1`"'

set -x JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home 

function .runElasticSearch
  docker run -p 9200:9200 -p 9300:9300 --name elastic -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.4.0

docker run --link elastic:elasticsearch -p 5601:5601 {docker-repo}:{version}
end

function .runZookeeper 
  cd /Users/vasubabujinagam/Documents/softwares/zookeeper/bin
  ./zkServer.sh start
end

function .stopZookeeper 
   cd /Users/vasubabujinagam/Documents/softwares/zookeeper/bin
  ./zkServer.sh stop
end

function .runKafka() 
  cd /Users/vasubabujinagam/Documents/softwares/kafka_2.11
  ./bin/kafka-server-start.sh config/server.properties
end

You can see there are not much differences from Bash to Fish. Happy Fishing!!!

Top comments (0)