Linux Command Syntax and Command Help

linux12 Linux Command Syntax and Command Help
Andrey Jone asked:

Linux Command Syntax can be very confusing. To compound matters, every command has slightly different Syntax. When you enter a command you will need to know what switch or options to use. This will allow you to turn a common command into a powerful tool.

One important thing to keep in mind is letter case. In Windows it does not care if a letter is capital or lower case. In Linux alphabet case matters. If you were to type “find” and “Find”, Linux would view these as totally separate entities. “find” is the command to search the file system. With the correct options it would perform a system search. “Find” is not defined, it will error out. Linux also does not like spaces. You should not name a file or directory including a space. If you are using multiple words you can divide the two words with a symbol such as “this_directory”

Command Help

For every command there are two levels of help. This will allow you to begin learning about what that command can do. The first way to look the help screen is this:

“commandname /help” or commandname /?”

This will give you a good starting point to learn the command options and syntax.

The second level of help is called a man page. “man” is short for manual. Most commands have a man page and its normally a couple pages of information about the command you are using. You can see any of the man pages by typing:

“man commandname”

Special care should be given when typing any Linux command. In Linux normally quotes are used to define and separate variables. In some cases multiple command options can be separated with commas. This is normally for user input though. For a simple idea about syntax we can break down the find command here:

find / -name ‘httpd.conf’

Here we have the find command, the “/” states what directory to search in. I have chosen root, however you could just as easily put any directory name. The “-name” basically tells find you are searching by name. Finally I have put the name in single quotes. In this case the quotes are not required.

Certain commands in Linux can be used with other commands. You can use “|” the pipe command to pipe output of one command through another. Such as

ps -ef | grep httpd

This is a process command to list all process’s. However you are taking the output of this command an piping it to the “grep” command. In this case it will only show the process’s associated with “httpd”.

Another command switch that works for most any command is “>” .

“find / -name httpd > list”

This will print the command output to a file called list.

Linux command syntax is hard to pick up at first. However through learning you can unlock the unlimited potential that your Linux System has to offer. Much more information about Linux commands can be found online. There are many good resources that will help you learn the commands of your Linux system. By using online sites, the man pages and command help you can soon become very familiar with your system.

Create a video blog

Related Posts

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment