LINUX CONSOLE GUIDE
The aim of this guide is to help people get to know how to use Linux through the command line.
Some of the commands below may be distro-specific, in whice case I will try and point that out.
1 - LOGGING IN
While this may seem obvious to some of you, many people THINK that there is a problem when they try and log in - this is because your password is not represented by ANY symbol when you are typing it. This is to help stop people from guessing your password, by counting the number of asterisks there are, or similar. So, after you've typed in your username and hit enter, its normal
for your password not
to show up as you are typing it.
2 - BROWSING FILES
OK, so you've just logged in to your Linux box. Normally, you will start off in your home directory. If you are logged in as root (the user account that has elevated security permissions, which you should only use under special circumstances), then your home directory is /root. If you are logged in under any other user account, then by default your home directory is /home/<username>/.
The Linux filesystem is different to that of windows. In Linux, you do not get drive letters - Everything is put into folders. The highest up you can get is "/", where you will normally have about 18 folders.
Below is a summary of commands that are very useful for browsing files.
- cd - This stands for Change Directory. Running "cd /home/j03" would CHANGE the directory which you are in to /home/j03.
- ls - This stands for List. If you type ls on it's own, it will list all of the files and folders within your current directory. You can also specify a directory after typing ls - for instance, if you ran "ls /var/www/", you would get a list of all of the files within the /var/www directory.
- cp - This command stands for copy. You can use it to copy one file (or directory) to another folder. Running "cp /home/j03/web/index.php /var/www/" would copy index.php to the /var/www/ folder. If you want to copy something and give it a new name, then you can specify that. Running "cp /home/j03/web/index.php /var/www/bob.php" would copy the file index.php to /var/www/, with a new name of bob.php
- mv - This stands for move. The syntax of the command is the same as above, but instead of copying, it moves. If you are new to the Linux command line, then it might be best if you use the copy command, and then remove the original file with the command below.
- rm - This stands for remove. a simple "rm index.php" will remove index.php, providing that you have the correct permissions. If you want to remove a folder, then you will need to use the -rf flag - For instance, running "rm -rf /var/www/old/" would remove the "old" directory from /var/www/. I cannot stress enough how careful you must be when using this command, especially if you are root. If you where to run "rm -rf /" as root, then you would destroy your linux machine, along with all of it's files.
There are a few popular text editors, including vi, and Nano.
TO BE CONTINUED... if you spot any mistakes, then could you PM me? Or just post in this thread.. haha.