Bash tips
Let Bash Save Your Aching Fingers
One the greatest things about Linux is that all you really need is a command prompt to get some work done. Of course, this comes at the expense of stressing out your finger muscles. Or... does it? Here's some nice little tips to save your aching fingers.
Sometimes you get tired of entering the same commands over and over again.
One the greatest things about Linux is that all you really need is a command prompt to get some work done. Of course, this comes at the expense of stressing out your finger muscles. Or... does it? Here's some nice little tips to save your aching fingers.
Sometimes you get tired of entering the same commands over and over again.
Code Listing 2.1: Very long ls command
$ ls -loBh --author --color=always --group-directories-first ~
$ ls -loBh --author --color=always --group-directories-first /var/log
Use the alias command to save a lot of typing
Code Listing 2.2: Alias to the rescue
$ alias ls='ls -loBh --author --color=always --group-directories-first'
Or better yet, make it permanent by putting the alias in your .bashrc
Code Listing 2.3: Making it permanent
$ echo "alias ls='ls -loBh --author --color=always --group-directories-first'" >> ~/.bashrc
$ ls -loBh --author --color=always --group-directories-first ~
$ ls -loBh --author --color=always --group-directories-first /var/log
Use the alias command to save a lot of typing
Code Listing 2.2: Alias to the rescue
$ alias ls='ls -loBh --author --color=always --group-directories-first'
Or better yet, make it permanent by putting the alias in your .bashrc
Code Listing 2.3: Making it permanent
$ echo "alias ls='ls -loBh --author --color=always --group-directories-first'" >> ~/.bashrc
