More Shell basics.

More Shell basics.

·

2 min read

having learnt some basics on how the shell works,

Here are some more command manipulations on the shell.

The way to create links is by using the ln command. man ln to learn more on the command. There are two types of links in GNU/Linux.

  • symbolic links

  • Hard links

Symbolic links are the equivalent of shortcuts on windows. They are created using the -s option like this: ln -s pathtolinkto pathwhereyouwantlinktoshowup This will create your link and you can use it to access the file (or run the contents of the file). An example is creating a shortcut to the ls file stored in the /bin directory an running it using the symbolic link.

To give the link a different name, give that name after specifying the path to the file you want linked to: ln -s pathtolinkto symlinkname . When the place where you want the link to e stored is not given, the link will be stored in the current directory.

Hard links basically contain the information of the original file. When the original file is deleted, the soft link will become useless (just like a shortcut to a deleted file on windows). However, for hard links contain the same information of the original file, including its inode number, the link will still give information about the file even if the file was deleted.

Using Commands with Wildcards.

Wildcards are useful in Linux as they help automate tasks and shorten commands. When the * is used in the terminal, it expands to include all characters. for example if you wanted to delete all files that end with the ~ character, usually generated by the emacs text editor, the command rm *~ will do it. Notice all files that end with ~ will be deleted without having to mention them one by one. To specify uppercase letters, [[:upper:]] is used. Wild cards can be used together so that to delete all files beginning with an uppercase letter, rm [[:upper:]]* can be used.

A future article will delve more into wildcards and how they are used in the shell.

Happy Shell navigation.