My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Tuesday, November 19, 2019

How to install Redis and run its instance


First, step first. You can simply install it using homebrew
$ brew install redis

After installation you can check that it creates a configutration file at:
/usr/local/etc/redis.conf

Then, you can verify the install as follows:
$ brew info redis

You can start an instance i.e Start Redis server using the configuration file.
$ redis-server /usr/local/etc/redis.conf

By default, it Runs in standalone mode on Port: 6379


Test if Redis server is running.
$ redis-cli ping
It will replu=y you pong!

To Uninstall Redis and its files.
$ brew uninstall redis


What more do you want. So cheers.
:)

How to install Homebrew (brew command) on Mac, linux

To Install Homebrew, you need to make use of ruby that is already installed. This is a simple command then.

On your terminal use following:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Paste that in a macOS Terminal prompt.

The script explains what it will do and then pauses before it does it. Read about other installation options. Install Homebrew on Linux and Windows Subsystem for Linux.

Voila!! That's it.


After this you can tyest which version is installed. Eg:
$ brew --version
Homebrew 2.1.16
Homebrew/homebrew-core (git revision 6176; last commit 2019-11-18)




Thursday, November 14, 2019

How to show full working directory in mac terminal on every command


Problem description:
You can obviously use a pwd command to see the present working directory. For eg:

prompt$ pwd
/Users/mfaiz/myDir

But sometimes you want to show the full directory path every time. Its a common ask for eg:
/Users/mfaiz/myDir$ pwd


Or, better still you want the directory path to be displayed on top before each command. All such issues can be handled using your bash profile file:


vi ~/.bash_profile


Solution: 
You can add this line -
export PS1='\u@\H:\w$'

or, if you like having a space between the $ and the command, then - 
export PS1='\u@\H:\w$ '



Shown following are two more complex examples that include coloring as well:




Command used to achieve this is:

export PS1="\n$C_LIGHTGREEN\u$C_DARKGRAY@$C_BLUE\h $C_DARKGRAY: $C_LIGHTYELLOW\w\n$C_DARKGRAY\$$C_DEFAULT "