Tag: man

By Clyde E. Boom

When you are a new user and trying to get Linux training, you need to learn how to use commands.

What you most often need is a clear, detailed example showing you exactly how to use a command.

And you’ll often hear seasoned Linux users say (over and over again) “just see the man page” for a command. This has become a quick and easy way out of really trying to explain how to use the command.

Linux man pages are useful if you already know how to use a command, but extremely frustrating if you are new to the OS (operating system).

Linux Training Tips: Linux man pages are practically useless for someone new. In fact, they’re almost as easy as trying to read hieroglyphics. Great for the ancient Egyptians – lots of really nice pictures, but really hard to read.

Here’s Why Man Pages Don’t Work for Someone New to Linux – And What You Can Do About It

linux man command“Man” stands for “manual”, as in “software documentation and you run the Linux man command to display the contents of a help page (file).

So, if you need help on a Linux command (or software program), you just run the man command to get instant online help.

Sounds great – but it’s not great for a new user.

And it would be great if the people that knew how to use Linux, didn’t expect the people that are new to understand man pages!

Linux Training Tips: The Linux System Administration concepts, commands and tasks covered here apply to ALL other Linux distributions, including: Red Hat, Fedora, Ubuntu, Kubuntu, Edubuntu, Slackware, Debian, SUSE and openSUSE.

Here’s how to run the Linux man command and get help on the grep command:

$ man grep

This displays the contents of the help page (file) for the grep command.

Linux Training Tips: There are several options of this command that can be used to display information on multiple pages. But hey, how do I get help on this command? You guessed it – just run: man man

Now, the grep command is pretty amazing in what it can do. It has lots of options and different ways of getting tons of useful information from a Linux system – but you’d never know it from looking at the man page.

The man page for any Linux command just shows you: a vague description of the command, a cryptic statement showing how to run the command, and a long alphabetic listing of the options. There’s no way of knowing which options are the most useful and most commonly used.

And the worst part is that it’s almost impossible to find an example of a command.

In the thousands of man pages, there are almost never any examples of how to use a command. And seeing examples of a command (and then running the command) – is the best way to learn how to use Linux.

Instead of trying to decipher a cryptic man page, imagine watching a clearly narrated Linux training videos. Easy training at it’s best!

With this Linux training method you get to see and hear how to use a command – or learn a new concept.

You see every step in the process – and whenever you need to think about something, or want to try a command you’ve just seen, you just click pause and try it yourself!

And now I would like to offer you free access to my Linux Commands Training Mini-Course, a 7 Lesson, Daily Mini-Course, including the free Linux Commands ebook and Linux audio podcasts – showing you how to get started learning how to use Linux commands.

You can get your instant access at: http://www.LinuxCommandsTrainingCourse.com

From Clyde Boom – The Easy Linux Training Guy – Easy, self-paced Linux training – In Plain English!

Tags: , , , ,

Important Unix Commands That You Should Know

By Bernard Peh

Unix is one of the most important operating system today. Its powerful features, scalability, strong security, and support for multiple users have made it the top choice operating systems for server, workstations and mainframes.

It is good to have some knowledge of Unix commands especially if your web host is Unix/Linux based. You could do alot of things by yourself by logging into the server via Secure Shell(SSH). This article will describe some of the important “need to know” Unix commands.

1. ls

This command will show you what files are in your current directory. If you add in a -F option, ie “ls -F xxx”, there will be a “/” appended to the end of directory names, * to executables and @ to links. “ls -a xxx” will display all hidden files as well. This is also the most used command.

2. cd

Change directory. If you type “cd xx”, it means to change to the specified directory “xx”. “cd ~” means to change to your default home directory.

3. cp “a b”

Copy file a to b. If b is a directory, the new file will be named b/a.

4. mv “a b”

Move files from a to b. For example, if I type “mv songs.txt /tmp”, the file songs.txt will be moved to /tmp/songs.txt. Moving a file is the same as renaming a file.

5. echo “text”

Print “text” to the terminal. If “text” is surrounded by double quotes, the text will be printed with any environment variables such as $HOME. If “text” is surrounded by single quotes, the “text” is printed without any special processing.

6. pwd

Print the current working directory. Useful command when you are lost in the directories.

7. cat “file”

Print the contents of the specified file(s) to the terminal.

8. less “file”

Display the specified file one screen at a time. Press the spacebar to go to the next screen. Press Q to quit. You often combine “less” with some other commands such as “cat abc | less”. This command means you print the contents of the file abc and display it one page at a time.

9. ps

Display information about your running programs. This is a good command to use if your server is slow and you suspect that some applications are taking too much memory. The most famous command using ps is “ps aux”. This will display useful information on the running programs.

10. rm

Remove or delete a file. If you type “rm -r directory”, it will remove a directory and all the files underneath it recursively.

11. man

This is the most important command. man means “manual”. If you are stuck with cat command for example, type “man cat” and you can see the help file.

Bernard Peh is a great passioner of web technologies and one of the co-founders of SiteCritic Website Reviews. He works with experienced web designers and developers for more than 5 years, developing and designing commercial and non-commercial websites. During his free time, he does website reviews,freelance SEO and PHP work.

Tags: , , , , , , , , , , ,

An Introduction to Linux Shell Commands

By Erick M Aqqa

The Linux system often intimidates beginners, what with the need to type in a command or two every now and then. However, Linux commands (or shell commands, to put it more accurately) follow a rather logical and sensible pattern and all you need to do is get used to it! Most shell commands are roughly 3, or at most 4 letters long. The more frequently needed commands are shortened further usually.

The man command is a reference to ‘manual’, i.e. the documentation that comes preloaded in Linux systems to help you with common problems faced by a user. These man(ual) pages are certainly not meant to be standalone guides for beginners, but instead, they need to be used as reference material to corroborate what you’ve learnt/tried elsewhere.

The info command is another way to look up reference material for GNU information and troubleshooting suggestions. It isn’t completely the same as the man pages, as there is a scope for using ‘hyperlinks’, to make it easier to browse through the material you need. There are shortcuts for scrolling through pages too.

The date command is self-explanatory. It will tell you about the current time and date on the system. On those lines, the cal command will display a neat calendar of the current month (or that of any particular one you choose).

The ls command is meant to help you list the contents of the directory you choose. This means that you will get to see all the files and directories inside your current directory.This command also has switches to modify its behavior and functionality. For example, adding -l after ls will give you a more detailed description of the contents of the directory you’re in. you’ll get to see details about file permissions, modification dates, groups, sizes and owners. The -a switch helps you see all the files in your current directory, including the hidden ones. (Hidden files in Linux have their filenames starting with a ‘.’ i.e. a period)

In case you lose track of the current directory you are in, type pwd, which prints the current directory you are working in. Once you’ve got to know that, you can navigate around the Linux file system using the cd command, where ‘cd’ stands for ‘change directory’. This can work on both relative and absolute terms, i.e., you can work by specifying the entire directory, starting from ‘/’ (the home directory) to the directory/file you want to go to. Otherwise, you can also use the ‘.’ or ‘..’ system. The latter tells the compiler that you want to go to the parent directory of your current one, making it an easy alternative to typing the entire path every time.

When you start working with simple files, like text files, the cat command will come in handy. It ‘concatenates’ the content of one or more text files, letting you see all of the text they contain.

The ps command lists all the processes currently running on your system in your current terminal.

The shell commands in this article are a good way to start off in the Linux environment. They are simple enough for you to get an idea of how the entire system works, and will probably help you to try out more advanced steps later!

To know more about Linux shell commands, click here

Linux2Aix is an upbeat Linux blog containing all the latest and the newest Linus news and how-to’s for both amateur and professional Linux lovers

Tags: , , , , , , ,

Linux Usr System Directory – Ls (List Directory) Command Examples – Quick Tips

By Clyde E. Boom

The Linux usr Directory

The usr directory, below the /, typically contains application software programs and utilities that can be shared across a network. It is the parent directory for many system components, including documentation files.

This directory is the “parent” for the share directory, which is the parent for doc, man and info.

These three directories contain documentation regarding Linux OS components and provide an excellent example of a well-organized directory structure.

You will see this illustrated for the “man” directories in the command examples below.

List the directories in the root and notice that the usr directory is “below” the /.

$ ls /

Now view the items in this directory.

$ ls /usr

Notice the doc, info and man directories.

Change into the share directory, below the path of /usr and list the contents.

Linux Commands Training Tips: You can use a ; (semicolon) with a space on either side, to run more than one Linux command on the same line.

$ cd /usr/share ; ls

Now use the Linux file “pattern” of “m*” to list only items beginning with “m”.

$ ls m*

This shows all items that begin with “m” and also shows the items (mostly files) in the directories beginning with “m”.

You can click on the top right arrow in your terminal emulation window to scroll up and see all of the output.

Directory names are flush left and on a single line and end in a : (colon).

Now use the -d option to show the directories only – and not the contents of the ones beginning with “m”.

$ ls -d m*

Now add the -l option to get a long listing.

$ ls -ld m*

Notice the directory named “man“. This is the parent directory of the Linux man pages, which are files providing documentation on system software components, including Linux commands.

The man command is used to view the contents of manual pages and can be run from any directory and as any Linux user.

$ man ls

This shows the man page for the ls command, which has a very brief description of the command and shows all of its options (preceded by a dash).

Press q to quit out of the man page.

Linux Commands Training Tips: Unfortunately, Linux man pages rarely show examples of how to use a command!

Now change into the man directory and view its contents.

$ clear ; cd man ; ls -ld man*

Each directory below contains files for a category of documentation.

The following command example uses the pattern of “ls.* to show the man page file in the man1 subdirectory that contains the description of the ls command that you saw above.

$ ls -l man1/ls.*

The Linux usr directory and command examples shown here apply to ALL Linux distributions, including Ubuntu, Kubuntu, Debian, SUSE, openSUSE, Fedora, Red Hat and Slackware Linux.

And now I would like to offer you free access to my Linux Commands Training Mini-Course, a 7 Lesson, Daily Mini-Course, including the free Linux Commands ebook and Linux audio podcasts – showing you how to get started learning how to use Linux commands.

You can get your instant access at: http://www.LinuxCommandsTrainingCourse.com

From Clyde Boom – The Easy Linux Training Guy – Easy, self-paced Linux training – In Plain English!

Tags: , , ,

Linux Kernel Manual Pages

By Erik Schweigert

Having the ability to lookup how a kernel function works is very handy when writing your own device driver or any kernel module. Unfortunately you cannot just apt-get install kernel-manpages. Well wouldn’t that be nice! To get your kernel manual pages for a specific kernel you can download the kernel source and execute a few choice commands. Here is a short tutorial under Debian (and would probably work for most Linux distributions).

  1. Download your kernel version, in this case I grabbed version 2.6.32.3
  2. Untar the the document by: tar -xvf linux-2.6.32.3.tar.bz2
  3. Now move into the new linux-2.6.32.3 directory and type make mandocs. The system might prompt you to download missing packages to build the manuals, proceed to do so.
  4. After the documents have been made type make installmandocs, this will install the manual pages into /usr/local/man/man9/. This way you can now type man copy_to_user to see how to use the specified kernel function!

So, doing a man copy_to_user you will now get the output of:

NAME

copy_to_user – Copy a block of data into user space.

SYNOPSIS

unsigned long copy_to_user (void __user * to, const void * from, unsigned long n);

ARGUMENTS

to

Destination address, in user space.

from

Source address, in kernel space.

n

Number of bytes to copy.

CONTEXT

User context only. This function may sleep.

DESCRIPTION

Copy data from kernel space to user space.

Returns number of bytes that could not be copied. On success, this will be zero.

Erik is an avid Linux user and has experience with a wide variety of Linux/Unix based systems. In his spare time he likes writing software (C/C++/Perl/PHP/BASH/Python) and experimenting with different Linux distributions. He is starting to build a wide variety of articles Unix driven (what a surprise) that hope to inform those just getting into Linux on his website.

http://www.lainoox.com

Tags: , ,

Linux Command Syntax and Command Help

By Andrey Jone

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.

Andrey Jone shares his views about Linux Command Syntax and Command Help. For more information on Linux Command Syntax and Command Help, please visit http://www.webhost.org

 

Tags: , , , ,
Back to top