| |||||||
This is a discussion on Basic Linux Commands within the Server Administration section, part of the Web Design/Development and SEO category; 1. Use cd to change directories: Type cd followed by the name of a directory to access that directory. Keep ...
![]() |
|
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
|
1. Use cd to change directories: Type cd followed by the name of a directory to access that directory. Keep in mind that you are always in a directory and allowed access to any directories hierarchically above or below. Ex: cd games If the directory "games" is not located hierarchically below the current directory, then the complete path must be written out. Ex: cd /usr/games To move up one directory, use the shortcut command. Ex: cd .. 2. Use clear to clear the command prompt: Type clear to clean up your command prompt window. This is especially helpful when you are typing lots of commands and need a clean window to help you focus. Ex: clear 3. Use date to set your server's date and time: Type date followed by the two digit month, the two digit date, the two digit time, and two digit minutes. The syntax is easy enough and resembles this: MMDDhhmm This command is helpful but must be used when superuser or logged in as root. Otherwise you will get an "Operation not permitted" reply. As root user you can use the command such as: date 11081300 The above command will set the server date and time to the 8th November, at 1:00pm. 4. Use df to check disk space: Typing df provides a very quick check of your file system disk space. Type df -h to get a more easily readable version of the output. Notice that this command will include all applicable storage such as your hard disk/s (hda, hdb etc.) and your server SWAP file (shm). To list disk space including filesystem type: df -h -T 5. Use finger to see who's on the system: Typing finger allows you to see who else is on the system or get detailed information about a person who has access to the system. Type finger followed by the name of a user's account to get information about that user. Or, type finger and press enter to see who's on the system and what they are doing. Ex: finger john 6. Use logout to quit using the system: Typing logout will log your account out of the system. Type logout at the prompt to disconnect from your Linux machine or to logout a particular user session from the system. Keep in mind that although rudimentary, leaving your critical account logged on may be a security concern. We always recommend promptly using logout when you are finished using your root account! Ex: logout 7. Use ls to list files and directories: Type ls to see a list of the files and directories located in the current directory. If you’re in the directory named games and you type ls, a list will appear that contains files in the games directory and sub-directories in the games directory. Examples: ls Mail ls /usr/bin Type ls -alt to see a list of all files (including .rc files) and all directories located in the current directory. The listing will include detailed, often useful information. Examples: ls -alt ls -alt /usr/bin If the screen flies by and you miss seeing a number of files, try using the |more at the end like: ls -alt |more 8. Use man to pull up information about a Linux command: Type man (stands for manual) followed by a command to get detailed information about how to use the command. Ex: man ls Type man -k followed by a word to list all of the commands and descriptions that contain the word you specified. Ex: man -k finger 9. Use more to read the contents of a file: Type more followed by the name of a text file to read the file’s contents. Why do we emphasize using this on a "text" file? Because most other types of files will look like garbage! Ex: more testfile.txt 10. Use nano or vi to start a text editor: Typing nano will start a basic text editor on most Linux systems. Type nano followed by the filename you wish to edit. This basic editor is quick and easy to use for beginners. Ex: nano /etc/security/access.conf OR vi /etc/security/access.conf 11. Use passwd to change your current password: Type passwd and press enter. You'll see the message Changing password for yourname. At the Old password: prompt, type in your old password. Then, at the Enter new password: prompt, type in your new password. The system double checks your new password. Beside the Verify: prompt, type the new password and press again. Always create a secure password that combines parts of words and numbers. 12. Use pwd to list the name of your current directory: Type pwd (stands for Print working Directory) and hit enter. You'll see the full name of the directory you are currently in. This is your directory path and is very handy. This is especially handy when you forget which directory you’ve changed to and are trying to run other commands.
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#2
| ||||
| ||||
|
Hi I would replace the command "more" with the command "less". less will also display a text file but it does it better than "more" does. There is an adage that always makes me remember this: Less is More Also, if you use nano as your text editor then you will need to start it with a -w switch to allow write mode...this can be set in an alias though so you do not have to think of it. I would also add to the list these basic commands: mkdir - to make a directory cp - to copy a file mv - to move a file rmdir - to remove a directory rm - to remove a file
__________________ Go placidly amid the noise and haste, and remember what peace there may be in silence The Desiderada |
|
#3
| ||||
| ||||
|
I have a nice list coming to add up into this. For now, let me add up a command just as a note to myself coz it took me quite some time in finding it out lol We cannot delete a non-empty directory using rmdir. The solution is: rm -f /path/to/nonemptydir/
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#4
| ||||
| ||||
|
It would be bad of me to forget dmesg and tail dmesg - for checking error output from commands. You may see no error when you run a command but you notice that it did not work as expected...dmesg and tail will help you track these errors down Also, if you want to see all the processes running on your Linux box, use "ps" to list the processes. If I am looking for something specific (the ssh damon for this example), I will use: ps | grep sshd This of course leads us to grep ![]() grep is a text search function. It has amazing power and flexibility. man grep for the full story!
__________________ Go placidly amid the noise and haste, and remember what peace there may be in silence The Desiderada |
|
#5
| ||||
| ||||
|
This can really help me sometime when I learn linux.
__________________ |
|
#6
| ||||
| ||||
|
Some nice basics covered here. Thanks for sharing though there is a lot more to go into it. |
|
#7
| ||||
| ||||
|
hi can someone tell me command for kill a process??
|
|
#8
| ||||
| ||||
|
Here are some basic linux and unix commands and a description of what they do. Hope they are helpful cat Lets you view the contents of a file. Many linux commands can use the redirection symbol > to redirect the output of the command. For example, use the redirection symbol with the cat command to copy a file: cat /etc/shells > newfile ( the contents of the shells file are written to newfile ). cd Changes the directory. chmod This command changes the attributes assigned to a file and is similar to the DOS Attrib command. clear Clears the screen. This command is useful when the screen has become cluttered with commands and data that you no longer need to view. cp Used to copy a file. date Entered alone, this command displays the current system date settings. Entered in the format date <mmddhhmmyy>, this command sete the system date.
__________________ smtp |
|
#9
| ||||
| ||||
|
Sorry, double post.... Last edited by Dingemans; 05-02-2012 at 06:07 PM. |
|
#10
| ||||
| ||||
|
I like it.........
|
![]() |
| Bookmarks |
| Tags |
| linux commands |
| Thread Tools | |
| Display Modes | |
| |