HomeTechnologyLinuxLearn to work with...

Learn to work with the shell

Want to learn how to use the command prompt, but afraid it’s too hard? Then you might want to start with a more user-friendly shell, such as fish. Afterwards you can always switch to bash, the default shell under Linux.

1.Shell

Long ago, the command line interface (or cli) was the only way to work on a Linux system. Since the advent of graphical desktop environments, this is no longer the case. Nevertheless, in modern distros the cli is still present. Open the terminal application of your distro and you will end up in the so-called shell. The shell is the program that passes your commands to the system and displays its output on the screen.

2. Fish

There are many shells for Linux, such as ksh (mostly popular with older sysadmins with a UNIX background), bash (the default Linux shell), and thus also fish. You still need to install Fish on the system. You do this with the following command in the bash shell:

sudo apt install fish

Then switch to fish:

fish

Don’t know where to start right away? Then enter the “help” command to open the extensive documentation in a browser.

3. Suggestions

The biggest stumbling block for beginners on the CLI is memorizing the huge amount of commands with their usual options. Fortunately, fish helps you with that task! As soon as you enter a few letters, fish tries to add them to an existing command. Also pay attention to the color in which fish shows the letters. As long as your entry is still in the red, it is not a valid assignment. If fish switches to blue, you have entered the name of an existing command and can now execute it. Does fish suggest the wrong command? Then press the tab key, choose the desired command with the arrow keys and press enter. Fish also immediately shows a brief description of each command, which is very handy!

4. Options

Once you’ve found the right command, use the same trick again to complete the necessary options. For example, do you want to unzip a file, but you don’t know (anymore) how to do that? Then enter a minus sign after the unzip command to indicate that an option follows. Then press the Tab key to display a list of all available options, including a short description. Select the desired option and confirm your choice with enter to continue building the assignment. Of course you can also select files via the tab key. A long command like:

unzip -l Downloads/2021-03-04-raspios-buster-armhf-lite.zip

Enter in fish with just a few keys:

unz Dow 2

5. History

If you perform the same command several times, you do not have to enter it again and again. You may have noticed that fish also shows your older commands in the suggestions. With the right arrow you choose the suggested assignment and with the up/down arrows you choose from the other older assignments. Can’t remember how the older assignment started, but still remember part of it? Then use the fish search function, for example:

historysearch download

You quickly execute the desired command by clicking it three times and then pressing the middle mouse button (the scroll wheel).

6. Scripting

With the fish-shell you can also write your own shell scripts. The syntax is a bit simpler than in bash, but that also means that you can’t just run fish scripts in bash (and vice versa, by the way). Keep that in mind when you look up example scripts on the internet!

- A word from our sponsors -

Most Popular

LEAVE A REPLY

Please enter your comment!
Please enter your name here

More from Author

An Unprecedented 190% Quantum Efficiency – New Material Could Drastically Increase the Efficiency of Solar Panels

Lehigh University researchers have created a revolutionary solar cell material with...

Even Brief Secondhand Smoke Exposure Increases Risk of Dangerous Heart Rhythm Disorder

New research indicates that even minimal exposure to secondhand smoke increases...

Neuronal Crossroads: Decoding Brain Development

New research uncovers the developmental pathways of inhibitory neurons in the...

Quantum Control Unlocked: Creating Resistance-Free Electron Channels

New research demonstrates control over quantum states that could revolutionize energy...

- A word from our sponsors -

Read Now

An Unprecedented 190% Quantum Efficiency – New Material Could Drastically Increase the Efficiency of Solar Panels

Lehigh University researchers have created a revolutionary solar cell material with up to 190% external quantum efficiency, pushing beyond conventional efficiency limits and showing great promise for enhancing future solar energy systems. Further development is required for practical application, supported by a U.S. Department of Energy grant.It...

Even Brief Secondhand Smoke Exposure Increases Risk of Dangerous Heart Rhythm Disorder

New research indicates that even minimal exposure to secondhand smoke increases the risk of atrial fibrillation, a common heart rhythm disorder. The study, involving over 400,000 adults from the UK Biobank, found a progressive increase in risk with longer exposure durations, regardless of the environment. The findings...

Neuronal Crossroads: Decoding Brain Development

New research uncovers the developmental pathways of inhibitory neurons in the brain, highlighting the roles of proteins like MEIS2 and DLX5 in neuron differentiation and the potential link to neurodevelopmental disorders through genetic mutations. Credit: SciTechDaily.comStudy reveals how proteins direct nerve cell precursors to turn into specialized...