Tips for Linux Newbies

These handy little tips will save you lots of headache and time. :-) There will be more tips added to this article; so stay tuned. 

1) Pay attention to the name of the file/folder with special characters such as uppercase, lowercase, underscore, and dash. In Unix, file/folder is identified EXACTLY as it is named. For example, Fri_day.php is totally different than Fri-day.php.

2) In Linux, you and “root” are two different entities. This is unique to Linux, so if you were a former Windows user like me, thinking that you have all administrative rights... well, wrong.  In order to perform administrative tasks, you must login as “root” or switch user, “su” at the terminal.  This is designed to protect the system files from being corrupted by hackers or newbies like you and me. So, take a deep breath and get accustomed to this.  You'll see the benefits later as you move toward a more sophisticated Unix user.

3) At the terminal, pay attention to the prompt as you open the window. It starts with something like: username@computername:~$.   The “$” indicates that you are “you,” (quite obvious, huh?)  So when you use a command like “sudo,” you are going to have administrative privileges like “root” temporarily.  But when you use a command like “sudo su,” you are going to switch from being “you” to “root.” You will be prompted for root password to gain root privileges.  Note, the prompt will change from “$” to “#.”  So whenever you see a command line that starts with #, you know that command requires you to be “root” in order to execute that command. Otherwise, you will have to use “sudo” over and over again.

4) Pay attention to file/folder permission; this  is a big deal in Linux. You may already own the folder – but not necessarily its sub-folders.  By default, except for the /home folder, which is yours; the rest, owned by root.  So if you know that you are going to need access to certain files/folders, make sure not only you but others have the read, write, and execute privileges. This can be done at the terminal by using the command, $ sudo chown -R username folder/file name. Of course if you are logged in as root, the command would simply be, # chown -R username folder/file name.  Always double check by right clicking on the folder/file, for permission privileges (Properties, Permissions, Owner/Group/Others to view.)  These permissions can be revoked later once the operations are done.

0 comments:

Post a Comment