LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   know right command (https://www.linuxquestions.org/questions/linux-newbie-8/know-right-command-4175426326/)

johnyhasan 09-09-2012 02:29 AM

know right command
 
i write a command:
ls
how can i check this command is right?

plz help me

Gunjo 09-09-2012 02:41 AM

You can check more about the command details by entering man command Eg. man ls. You will see the details of that command and related options about the same.

For learning basic commands visit linuxcommand.org

colucix 09-09-2012 03:17 AM

I second the suggestion by Gunjo: the Linux Command Line is a good resource for learning. Moreover you may download the free PDF to have it at hand when you're working off-line.

Regarding your practice with the command line, indeed the man pages are a valid resource (especially as a reminder of the long list of options available to some commands, like ls). You have to pay more attention to those commands that act on files, like rm (potentially very dangerous for obvious reasons), mv, cp and so on. A good practice would be to put an echo in front of the command and review the actual command line before executing it, especially when you use wild cards. Example:
Code:

$ echo rm *.png
rm tides_error_2km.png tides_error.png

if I see the shell substitution has been performed as expected and the command matches what I meant to achieve, then I can safely do:
Code:

$ rm *.png
Another good practice is to check where you are at any time before executing (potentially) dangerous commands and you have pwd to print the path of the current working directory.

Finally, I suggest to carefully read all the error messages you get. In the majority of the cases they reveal what the error is and may give you a clue to what is the right thing to do.

Gunjo 09-09-2012 03:29 AM

Quote:

Originally Posted by colucix (Post 4776012)
I second the suggestion by Gunjo: the Linux Command Line is a good resource for learning. Moreover you may download the free PDF to have it at hand when you're working off-line.

Regarding your practice with the command line, indeed the man pages are a valid resource (especially as a reminder of the long list of options available to some commands, like ls). You have to pay more attention to those commands that act on files, like rm (potentially very dangerous for obvious reasons), mv, cp and so on. A good practice would be to put an echo in front of the command and review the actual command line before executing it, especially when you use wild cards. Example:
Code:

$ echo rm *.png
rm tides_error_2km.png tides_error.png

if I see the shell substitution has been performed as expected and the command matches what I meant to achieve, then I can safely do:
Code:

$ rm *.png
Another good practice is to check where you are at any time before executing (potentially) dangerous commands and you have pwd to print the path of the current working directory.

Finally, I suggest to carefully read all the error messages you get. In the majority of the cases they reveal what the error is and may give you a clue to what is the right thing to do.

Thanks colucix


All times are GMT -5. The time now is 02:37 AM.