A command-line interface or command language interpreter (CLI), also known as command-line user interface, console user interface and character user interface (CUI) is defined by Wikipedia as a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines).
Today, many end users rarely use command-line interfaces and instead rely on graphical user interfaces and menu-driven interactions.
While program that handles the interface is called a command language interpreter. But we as RUSHprime we simply define Command line interface as a text interface for your computer. It is a program that takes in commands from user input then it passes it to computer’s operating system to run.
By use of command line, you can easily navigate through files and folders on your pc or computer, just as you would with Windows Explorer on Windows or Finder on Mac OS. The difference is that the command line is fully text-based.
Alternatives to the command line include: text user interface menus (such as IBM AIX SMIT), keyboard shortcuts, and various other desktop metaphors centered on the pointer (usually controlled with a mouse). Examples of this include the Windows versions 1, 2, 3, 3.1, and 3.11, Deshell, and Mouse Systems Power Panel.
Programs with command-line interfaces are generally easier to automate via scripting. Command-line interfaces for software include a number of programming languages such as Tcl/Tk, PHP. We us RUSHprime help customers develop cheap and reliable Command-line-Interface feel free to message us for one using the form in the right sidebar.
Also don’t forget to visit our home page and view services that we offer to our clients
Advantages of Command Line Interface (CLI):
The advantages of Command line interfaces are listed below;
- If the user knows the correct commands then this type of interface can be much faster than any other type of interface.
- This type of interface needs much less memory (Random Access Memory) in order to use compared to other types of user interfaces.
- This type of interface does not use as much CPU processing time as others
- A low resolution, cheaper monitor can be used with this type of interface.
- A CLI does not require Windows to run.
below are common commands.
> takes the standard output of the command on the left, and redirects it to the file on the right.
>> takes the standard output of the command on the left and appends(adds) it to the file on the right.
< takes the standard input from the file on the right and inputs it into the program on the left.
| is a “pipe”. The
| takes the standard output of the command on the left, and pipes it as standard input to the command on the right. You can think of this as “command to command” redirection.
~/.bash_profile is the name of file used to store environment settings. It is commonly called the “bash profile”. When a session starts, it will load the contents of the bash profile before executing commands.
alias command allows you to create keyboard shortcuts, or aliases, for commonly used commands.
cd takes a directory name as an argument, and switches into that directory.
To navigate directly to a directory, use
cd with the directory’s path as an argument. Here,
cd jan/memory/ command navigates directly to the jan/memory directory.
To move up one directory, use
cd ... Here,
cd .. navigates up from jan/memory/ to jan/.
cp copies files or directories. Here, we copy the file ada_lovelace.txt and place it in the historical/ directory
* selects all of the files in the current directory. The above example will copy all of the files in the current directory to the directory called satire. There are other types of wildcards, too, which are beyond the scope of this glossary.
Here, m*.txt selects all files in the working directory starting with “m” and ending with “.txt”, and copies them to scifi/.
env command stands for “environment”, and returns a list of the environment variables for the current user.
ENV | GREP VARIABLE
env | grep PATH is a command that displays the value of a single environment variable.
export makes the variable to be available to all child sessions initiated from the session you are in. This is a way to make the variable persist across programs.
grep stands for “global regular expression print”. It searches files for lines that match a pattern and returns the results. It is case sensitive.
grep -i enables the command to be case insensitive.
grep -R searches all files in a directory and outputs filenames and lines containing matched results.
-R stands for “recursive”.
grep -Rl searches all files in a directory and outputs only filenames with matched results.
-R stands for “recursive” and
l stands for “files with matches”.
HOME variable is an environment variable that displays the path of the home directory.
ls lists all files and directories in the working directory
ls -a lists all contents in the working directory, including hidden files and directories
ls -l lists all contents of a directory in long format. Here’s what each column means.
ls -t orders files and directories by the time they were last modified.
mkdir takes in a directory name as an argument, and then creates a new directory in the current working directory. Here we used mkdir to create a new directory named media/.
To move a file into a directory, use mv with the source file as the first argument and the destination directory as the second argument. Here we move superman.txt into superhero/.
nano is a command line text editor. It works just like a desktop text editor like TextEdit or Notepad, except that it is accessible from the the command line and only accepts keyboard input.
PATH is an environment variable that stores a list of directories separated by a colon. Each directory contains scripts for the command line to execute. PATH lists which directories contain scripts.
pwd prints the name of the working directory
rm deletes files. Here we remove the file waterboy.txt from the file system.
rm -r deletes a directory and all of its child directories.
sed stands for “stream editor”. It accepts standard input and modifies it based on an expression, before displaying it as output data.
In the expression
s: stands for “substitution”.
snow: the search string, the text to find.
rain: the replacement string, the text to add in place.
sort takes a filename or standard input and orders each line alphabetically, printing it to standard output.
standard error, abbreviated as
stderr, is an error message outputted by a failed process.
source activates the changes in ~/.bash_profile for the current session. Instead of closing the terminal and needing to start a new session,
sourcemakes the changes available right away in the session we are in.
standard input, abbreviated as
stdin, is information inputted into the terminal through the keyboard or input device.
standard output, abbreviated as
stdout, is the information outputted after a process is run.
touch creates a new file inside the working directory. It takes in a file name as an argument, and then creates a new empty file in the current working directory. Here we used touch to create a new file named keyboard.txt inside the 2014/dec/ directory.
If the file exists, touch is used to update the modification time of the file
uniq, short for “unique”, takes a filename or standard input and prints out every line, removing any exact duplicates.