Bash Shell —Other Useful commands

Miguel Sampaio da Veiga
Jan 8 · 3 min read
Photo by Pixabay from Pexels

So far this series of articles have presented a simple and concise perspective about navigate in the shell, visualize content, manipulate files and folders, and edit files inline.

This article is about a list of helpful commands available in the shell that might make a diference and simplify your workflow.

File

$ file test_file

File determines the test_file file type. It operates three kinds of tests to determine the type. It takes several arguments:

file usage example

Type

$ type command names

Type is used to determine if a command is built-in or is an external binary file:

type usage example

It accepts the following options:

$ type -a command

Shows also if command is an alias and the path:

$ type -t command

Shows a single word for the command type

$ type -p command

Shows the name and path of the file that will execute:

Which

$ which command

Which shows the full path of a command passed as argument:

which usage example

Help

$ help command

Help displays information about builtin commands.

help usage example

Man

$ man command

Man in as interface to the system reference manuals

Apropos

$ apropos keyword

Apropos is another way of using the system reference manuals. Instead of views a single manual, apropos searches the short description for instances of keyword and returns all that apply. Keyword can be a regular expression.

Info

$ info command

Another way of consulting the system reference manuals with more detailed information.

Whatis

$ whatis command

Another way of consulting the system reference manuals. whatis displays on-line command descriptions.

whatis usage example

Alias

$ alias name=”value”

This command instructs the shell to replace the “name” with “value” whenever we input “name”:

alias usage example

An alias defined in the .xsession, .bashrc, .profile will be usable through the system.

To eliminate the alias run “unlias”:

History

$ history

History shows the shell last entered commands.

$ !!

This command executes the previous entered command.

$ !300

This command executes the command in the history 300th line.

$ !300:p

This command prints the command in the history 300th line.

History can also be used with grep. In the next article I’ll talk about it.

Hacker Toolbelt

Hacking tools and how-to

Miguel Sampaio da Veiga

Written by

Security consultant

Hacker Toolbelt

Hacking tools and how-to

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade