Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Wednesday, November 16, 2016

Assigning to a variable from a pipe in Z Shell

Assigning to a variable from a pipe in Z Shell


Unfortunately or sadly, this could not be done by me for my use case in Bash. Im looking for a good solution in Bash too. Just to note here. To read from the pipe you just have to use the Read command. It only works this way in Zsh so far.
blkid $dev | sed -n s/.*UUID="([^"]*)".*/1/p | read var;
Now you can easily use that $var in that scope like
echo $var


Go to link download

Read more »

Z Shell the fancy in Linux terminal

Z Shell the fancy in Linux terminal


Z Shell is probably now the best known Shell option for Unix users all over the globe. That too contributed by the fact that most people take the Terminal they get as full and final and never give a second thought about its improvement. But geeks cant resist exploring and the first option they get astounds them because Z Shell, if compared to Bash, is simple a super set of its functionality. It gives us a great Terminal which is intelligent and customizable to the point where people might ask you "Which terminal is this?".

Installation: This is fairly simple. Just a quick apt-get

sudo apt-get install zsh
Configuration: After you have installed Z Shell, the very first thing you have to do launch is type in your terminal

zsh
The first you do this, you will get some configuration manual that is navigated using numbers. The procedures are very self explanatory. It helps you configure various Options such as
  • How far back in time do you want to remember commands
  • If you want the shell to search history using partially entered commands (Its neat and powerful)
  • Should all of your terminals be in sync while running
The whole configuration is saved into the file at /home//.zshrc.
After you have configured the shell, you can make it your default shell using the command

chsh -s /bin/zsh

Configuration repositories: Some great configurations for Zsh have come up with full modular support and themes that will make your experience with Z a breeze. These are the most popular to repositories.
  • Oh My Zsh
  • Prezto
There are some others that maintain Z shell configurations around the net.
Using these pre-built configurations is very easy. Such as, configuring with Prezto. You need to type in the following after launching Z Shell. The commands will create Z Shell configurations in your home directory.

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
This will simple clone the repository into your home folder and then, link the configurations in place of your current configurations.



Go to link download

Read more »

Wednesday, August 24, 2016

Linux shell cheatsheet Can it become one

Linux shell cheatsheet Can it become one


I love the command line, the CLI. I wish somethings were a little bit different allowing me to use CLI for every task, but the world is a cruel place, apart from stupid M$ mistakes regarding their crappy GUI. You do realize there wouldnt be such a crappy product without dependency on the GUI, right?
Im not categorizing it right now, because theres not much to categorize actually

Show line number in "grep" output: grep "text" -n



Go to link download

Read more »