Useful CLI Commands

echo $SHELL:

Tells you what shell you are in. Yes, there are different types of shells but bash is usually the default and most widely used.

"CTRL+C":
It will stop most things from running that have already started and can't seem to be stopped.

"CTRL+D":
Exits the current shell session.

"clear" or "CTRL+L":
Will clear your screen.

"shopt":
Shows some options you have in bash by default.

"shopt": - "-s" = on and "-u" = off
Turns some options you have in bash off or on.

"shopt -s cdspell":
Minor spelling errors in a directory command will be corrected automatically and will automatically put you in that directory.
I.E., /tpm will be automatically change to /tmp (for the temp directory) and will automatically put you there.

"shopt -s dirspell":
Similar to the one above but makes a guess at what would be correct when it finds an error.

"shopt -s nocaseglob":
ignores upper and lower case typing.

Using the "TAB" key:
If you are not sure of the name of a directory try "cd /cp" then hit the "TAB" key twice. It will show you everything in the current folder that starts with "cp" such as "cpanel".

"ALT+F":
Move the cursor forward one word.

"ALT+B":
Move the cursor back one word.

"CTRL+A":
Move the cursor to the beginning of a line.

"CTRL+E":
Move the cursor to the end of a line.

"clear" or "CTRL+L":
Clears the terminal screen.

"file":
Shows you a file type. I.E., "file file.txt" will tell you that it is a text file. While ".Downloads" will tell you that it is a directory, because of the dot in front of it.

"locate":
Finds files throughout your system. Usage - "locate filename". You may have to install it and/or update it's database using the following if the command is not found or doesn't work correctly:
yum -y update
yum -y install mlocate
updatedb

"which":
Shows the full path of shell commands.

"apropos":
Search the manual page names and descriptions. I.E, "apropos time" will give you a list of time commands and a description.

"last":
Will show you a list of users who have successfully logged into your server via SSH within the last 24 hours.

"lastb":
Will show you a list of users who have unsuccessfully tried logged into your server via SSH within the last 24 hours.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Accessing Your Files

There are a number of ways to access and edit your files. The most obvious is using FTP. But for...

How To Add a Warning Message To SSH

You've seen the warning messages when a hacker tries to enter a server and it says something...

How to secure SSH - Part 1

In Part 1, we'll be discussing various ways to secure your SSH terminal. Before attempting any of...

Restarting The SSH Service

After using certain SSH commands you may wish or need to restart the SSH daemon (sshd) to make...

How To Change File and Directory Permissions

Sometimes when we upload files via FTP software or install mods or plugins via a forum or blog,...