Linux Tutorials
About Lesson

A command is a specific instruction given to a computer application to perform some kind of task or function.

In Windows, commands are usually entered via a command line interpreter, like Command Prompt or Recovery Console.

Commands must always be entered into a command line interpreter exactly. Entering a command incorrectly (wrong syntax, misspelling, etc.) could cause the command to fail or worse, could execute the wrong command or the right command in the wrong way, creating serious problems.

There are many different kinds of commands, and many phrases that use the word command that probably shouldn’t because they’re not actually commands. It can be kind of confusing.

Below are some popular kinds of commands you might encounter.

Command Prompt Commands

Command Prompt commands are true commands. True commands are programs that are intended to be run from a command line interface (in this case the Windows Command Prompt) and whose action or result is also produced in the command line interface.

DOS Commands

DOS commands, more correctly called MS-DOS commands, might be considered the “purest” of the Microsoft based commands since MS-DOS has no graphical interface so each command lives completely in the command line world.

Don’t confuse DOS commands and Command Prompt commands. MS-DOS and the Command Prompt may appear similar but MS-DOS is a true operating system while Command Prompt is a program that runs within the Windows operating system. Both share many commands but they are certainly not the same.

Run Commands

A run command is simply the name given to an executable for a particular Windows-based program.

A run command is not a command in the strictest sense — it’s more like a shortcut. In fact, the shortcuts that live in your Start Menu or on your Start Screen are usually nothing more than an icon representation of the executable for the program — basically a run command with a picture.

For example, the run command for Paint, the painting and drawing program in Windows, is mspaint and can be run from the Run box or Search box, or even from the Command Prompt, but Paint is obviously not a command line program.

Some other examples are a bit more confusing. The run command for Remote Desktop Connection, for example, is mstsc but this run command does have some command line switches that make opening the program with specific parameters very easy. However, Remote Desktop Connection is not a program designed for the command-line so it’s not really a command.

Control Panel Commands

Another command you’ll see referenced that isn’t really a command is the Control Panel applet command. A Control Panel applet command is really just the run command for the Control Panel (control) with a parameter instructing Windows to open a specific Control Panel applet.

For example, executing this command opens the Date and Time applet in Control Panel directly.

control /name Microsoft.DateAndTime

You can execute this command from the Command Prompt, but the Control Panel is not a command line program.

Recovery Console Commands

Recovery Console commands are also true commands. Recovery Console commands are only available from within the Recovery Console, the command line interpreter available only for troubleshooting problems and only in Windows XP and Windows 2000.

Pwd(Print Working Directory)

It Simply print where you are currently working directory location. Open a command line interface (also called a terminal, console or xterm) and type pwd.

hackonology@ubuntu:~$ pwd
/home/hackonology

Cd(Change Directory)

You can change your current directory with the cd command (Change Directory).

hackonology@ubuntu:~$ pwd
/home/hackonology

cd ~

The cd is also a shortcut to get back into your home directory. Just typing cd without a target
directory, will put you in your home directory. Typing cd ~ has the same effect.

hackonology@ubuntu$ pwd
/home/hackonology

hackonology@ubuntu$ cd /etc
hackonology@ubuntu$ pwd
/etc

hackonology@ubuntu$ cd ~
hackonology@ubuntu$ pwd
/home/hackonology

cd ..

To go to the parent directory (the one just above your current directory in the directory
tree), type cd .. .

hackonology@ubuntu$ pwd
/usr/share/games
hackonology@ubuntu$ cd ..
hackonology@ubuntu$ pwd
/usr/share

cd –

Another useful shortcut with cd is to just type cd – to go to the previous directory.

hackonology@ubuntu$ pwd
/home/hackonology

hackonology@ubuntu$ cd /etc
hackonology@ubuntu$ pwd
/etc

hackonology@ubuntu$ cd -
hackonology@ubuntu$ pwd
/home/hackonology

Absolute and Relative paths

You should be aware of absolute and relative paths in the file tree. When you type a path
starting with a slash (/), then the root of the file tree is assumed. If you don’t start your path
with a slash, then the current directory is the assumed starting point.
The screenshot below first shows the current directory /home/hackonology. From within this
directory, you have to type cd /home instead of cd home to go to the /home directory.

hackonology@ubuntu$ pwd
/home/hackonology
hackonology@ubuntu$ cd home
bash: cd: home: No such file or directory
hackonology@ubuntu$ cd /home
hackonology@ubuntu$ pwd
/home

When inside /home, you have to type cd hackonology instead of cd /hackonology to enter the subdirectory hackonology of the current directory /home.

hackonology@ubuntu$ pwd
/home
hackonology@ubuntu$ cd /hackonology
bash: cd: /paul: No such file or directory
hackonology@ubuntu$ cd hackonology
hackonology@ubuntu$ pwd
/home/hackonology

ls

You can list the contents of a directory with ls

hackonology@ubuntu:~$ ls
allfiles.txt dmesg.txt services stuff summer.txt
hackonology@ubuntu:~$

ls -a

A frequently used option with ls is -a to show all files. Showing all files means including
the hidden files. When a file name on a Linux file system starts with a dot, it is considered
a hidden file and it doesn’t show up in regular file listings.

hackonology@ubuntu:~$ ls
allfiles.txt dmesg.txt services stuff summer.txt
hackonology@ubuntu:~$ ls -a
. allfiles.txt .bash_profile dmesg.txt .lesshst stuff..  .bash_history .bashrc services .ssh summer.txt

mkdir

Walking around the Unix file tree is fun, but it is even more fun to create your own directories
with mkdir. You have to give at least one parameter to mkdir, the name of the new directory
to be created. Think before you type a leading / .

hackonology@ubuntu:~$ mkdir mydir
hackonology@ubuntu:~$ cd mydir
hackonology@ubuntu:~/mydir$ ls -al
total 8
drwxr-xr-x 2 hackonology hackonology 4096 Sep 17 00:07 .
drwxr-xr-x 48 hackonology hackonology 4096 Sep 17 00:07 ..
hackonology@ubuntu:~/mydir$ mkdir stuff
hackonology@ubuntu:~/mydir$ mkdir otherstuff
hackonology@ubuntu:~/mydir$ ls -l
total 8
drwxr-xr-x 2 hackonology hackonology 4096 Sep 17 00:08 otherstuff
drwxr-xr-x 2 hackonology hackonology 4096 Sep 17 00:08 stuff
hackonology@ubuntu:~/mydir$

mkdir -p

The following command will fail, because the parent directory of threedirsdeep does not
exist.

hackonology@ubuntu:~$ mkdir mydir2/mysubdir2/threedirsdeep
mkdir: cannot create directory ‘mydir2/mysubdir2/threedirsdeep’: No such file or directory

When given the option -p, then mkdir will create parent directories as needed

hackonology@ubuntu:~$ mkdir -p mydir2/mysubdir2/threedirsdeep
hackonology@ubuntu:~$ cd mydir2
hackonology@ubuntu:~/mydir2$ ls -l
total 4
drwxr-xr-x 3 hackonology hackonology 4096 Sep 17 00:11 mysubdir2
hackonology@ubuntu:~/mydir2$ cd mysubdir2
hackonology@ubuntu:~/mydir2/mysubdir2$ ls -l
total 4
drwxr-xr-x 2 hackonology hackonology 4096 Sep 17 00:11 threedirsdeep
hackonology@ubuntu:~/mydir2/mysubdir2$ cd threedirsdeep/
hackonology@ubuntu:~/mydir2/mysubdir2/threedirsdeep$ pwd
/home/paul/mydir2/mysubdir2/threedirsdeep

rm

rm command is used to delete a file or a directory.

hackonology@ubuntu$ rm directory or file name

rm -p

similar to the mkdir -p option, you can also use rm to recursively remove directories.

hackonology@ubuntu$ rm -p mydir2/mysubdir2/threedirsdeep
There are several types of file in Ubuntu Linux :

Regular files

they contain data, for example text files, executable files or programs, input in or output out from a program and such.Directories

are files/folders that are lists of other files.Special files

this is the mechanism used for input and output. Most special files are in /dev.Links

this is a system to make a file or directory visible in several parts of the system’s file tree. Domain sockets

this a special file type its similar to TCP/IP sockets in windows. It will provide inter-process networking that’s protected by the file system’s access control.

Let’s Join our Hacking Team

We Are Indian We Are Great

Hope this article helpful for you. Thank You

Indian Cyber Army | Make IT Secure

Enjoy…Stay Happy…Stay Secure…

Named pipes

these act more or less like sockets and are a way for processes to communicate with each other, without using network socket protocols.

 

Hope this article helpful for you. Thank You


If You Appreciate What We Do Here On Hackonology, You Should Consider:

Hackonology is the fastest growing and most trusted community site where you can find lots of courses, articles about Technology/Hacking/Cracking. Millions of people visit Hackonology! to search or browse the thousands of published articles available FREELY to all.

Let's be a part of Hacker's Community! Join our Hacking Team

We Are Indian We Are Great