Command
|
Summary Use
|
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. You may also benefit from reviewing my directory commands page.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 .. |
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 This is also useful when you are getting ready to type a rather long command and do not wish to become confused by other details on the screen. |
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. You can get more help with administrator commands by clicking this link. Note that if you don't use root, 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 11th month (November), the 8th day, at 1:00pm. |
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 |
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 johndoe |
Use logout to quit using the system
|
Yep, you guessed it, 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 |
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
* In Bash (Linux shell) often the
abbreviated command L is available. To get a verbose listing of files and
directories you could therefore simply type: l
|
Use man
to pull up information about a Linux command
|
Type man 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 |
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 exmphasize using this on a "text" file? Because
most other types of files will look like garbage! Ex:
more testfile.txt |
Use nano 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. However, it is very important that you also learn about other text editors available on Linux and UNIX systems. Click on this link to learn about others like emacs, vi, and pico. Ex: nano /etc/security/access.conf |
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. Create a secure password that combines parts of words and numbers. For instance, your dog's name may be Rufus. He may have been born in 1980. Create a password that uses parts of both the name and date of birth, such as 80rufuS. Note the use of at least one capital letter. This is a fairly secure password and easy to remember. |
Use pwd
to list the name of your current directory
|
Type pwd
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.
|
Friday, 29 March 2013
Linux Basic Commands
Sunday, 24 March 2013
Practical list before MST
1. Instllation Of RED HAT Linux.
2. Basic commands of Linux Operating System.
3. Creating User and Groups and assign Users to Groups in Linux Command Line.
4. Implement permissions in Linux command Line.
5. INIT process
6. Implement Disk Quota in Linux.
7. Implement Mount and Unmount Process in Linux.
Monday, 18 March 2013
Intro to Linux
Linux Operating System
Linux is a free open-source operating system based on Unix. Linux was originally created by Linus Torvalds with the assistance of developers from around the globe. Linux is free to download, edit and distribute. Linux is a very powerful operating system and it is gradually becoming popular throughout the world.
Advantages of Linux
Low cost: There is no need to spend time and huge amount money to obtain licenses since Linux and much of it's software come with the GNU General Public License. There is no need to worry about any software's that you use in Linux.
Stability: Linux has high stability compared with other operating systems. There is no need to reboot the Linux system to maintain performance levels. Rarely it freeze up or slow down. It has a continuous up-times of hundreds of days or more.
Performance: Linux provides high performance on various networks. It has the ability to handle large numbers of users simultaneously.
Networking: Linux provides a strong support for network functionality; client and server systems can be easily set up on any computer running Linux. It can perform tasks like network backup more faster than other operating systems.
Flexibility: Linux is very flexible. Linux can be used for high performance server applications, desktop applications, and embedded systems. You can install only the needed components for a particular use. You can also restrict the use of specific computers.
Compatibility: It runs all common Unix software packages and can process all common file formats.
Wider Choice: There is a large number of Linux distributions which gives you a wider choice. Each organization develop and support different distribution. You can pick the one you like best; the core function's are the same.
Fast and easy installation: Linux distributions come with user-friendly installation.
Better use of hard disk: Linux uses its resources well enough even when the hard disk is almost full.
Multitasking: Linux is a multitasking operating system. It can handle many things at the same time.
Security: Linux is one of the most secure operating systems. File ownership and permissions make linux more secure.
Open source: Linux is an Open source operating systems. You can easily get the source code for linux and edit it to develop your personal operating system.
Today, Linux is widely used for both basic home and office uses. It is the main operating system used for high performance business and in web servers. Linux has made a high impact in this world.
Difference between Linux and Windows
Linux Vs Windows
Linux is an open-source Operating System. People can change codes and add programs to Linux OS which will help use your computer better. Linux evolved as a reaction to the monopoly position of windows. you can't change any code for windows OS. You can't even see which processes do what and build your onw extension. Linux wants the programmers to extend and redesign it's OS. Linux user's can edit its OS and design new OS.
All flavors of Windows come from Microsoft. Linux come from different companies like LIndows , Lycoris, Red Hat, SuSe, Mandrake, Knopping, Slackware.
Linux is customizable but Windows is not. For example,NASlite is a version of Linux that runs off a single floppy disk and converts an old computer into a file server. This ultra small edition of Linux is capable of networking, file sharing and being a web server.
Linux is freely available for desktop or home use but Windows is expensive. For server use, Linux is cheap compared to Windows. Microsoft allows a single copy of Windows to be used on one computer. You can run Linux on any number of computers.
Linux has hign security. You have to log on to Linux with a userid and password. You can login as root or as normal user. The root has full previlage.
Linux has a reputation for fewer bugs than Windows.
Windows must boot from a primary partition. Linux can boot from either a primary partition or a logical partition inside an extended partition. Windows must boot from the first hard disk. Linux can boot from any hard disk in the computer.
Windows uses a hidden file for its swap file. Typically this file resides in the same partition as the OS (advanced users can opt to put the file in another partition). Linux uses a dedicated partition for its swap file.
Windows separates directories with a back slash while Linux uses a normal forward slash.
Windows file names are not case sensitive. Linux file names are. For example "abc" and "aBC" are different files in Linux, whereas in Windows it would refer to the same file.
Windows and Linux have different concepts for their file hierarchy. Windows uses a volume-based file hierarchy while Linux uses a unified scheme. Windows uses letters of the alphabet to represent different devices and different hard disk partitions. eg: c: , d: , e: etc.. while in linux " / " is the main directory.
Linux and windows support the concept of hidden files. In linux hidden files begin with " . ", eg: .filename
In Linux each user will have a home directory and all his files will be save under it while in windows the user saves his files anywhere in the drive. This makes difficult to have backup for his contents. In Linux its easy to have backup's.
Linux Pros
A lot of the advantages of Linux are a consequence of Linux' origins, deeply rooted in UNIX, except for the first advantage, of course:- Linux is free:
As in free beer, they say. If you want to spend absolutely nothing, you don't even have to pay the price of a CD. Linux can be downloaded in its entirety from the Internet completely for free. No registration fees, no costs per user, free updates, and freely available source code in case you want to change the behavior of your system.
Most of all, Linux is free as in free speech:
The license commonly used is the GNU Public License (GPL). The license says that anybody who may want to do so, has the right to change Linux and eventually to redistribute a changed version, on the one condition that the code is still available after redistribution. In practice, you are free to grab a kernel image, for instance to add support for teletransportation machines or time travel and sell your new code, as long as your customers can still have a copy of that code. - Linux is portable to any hardware platform:
A vendor who wants to sell a new type of computer and who doesn't know what kind of OS his new machine will run (say the CPU in your car or washing machine), can take a Linux kernel and make it work on his hardware, because documentation related to this activity is freely available. - Linux was made to keep on running:
As with UNIX, a Linux system expects to run without rebooting all the time. That is why a lot of tasks are being executed at night or scheduled automatically for other calm moments, resulting in higher availability during busier periods and a more balanced use of the hardware. This property allows for Linux to be applicable also in environments where people don't have the time or the possibility to control their systems night and day. - Linux is secure and versatile:
The security model used in Linux is based on the UNIX idea of security, which is known to be robust and of proven quality. But Linux is not only fit for use as a fort against enemy attacks from the Internet: it will adapt equally to other situations, utilizing the same high standards for security. Your development machine or control station will be as secure as your firewall. - Linux is scalable:
From a Palmtop with 2 MB of memory to a petabyte storage cluster with hundreds of nodes: add or remove the appropriate packages and Linux fits all. You don't need a supercomputer anymore, because you can use Linux to do big things using the building blocks provided with the system. If you want to do little things, such as making an operating system for an embedded processor or just recycling your old 486, Linux will do that as well. - The Linux OS and most Linux applications have very short debug-times:
Because Linux has been developed and tested by thousands of people, both errors and people to fix them are usually found rather quickly. It sometimes happens that there are only a couple of hours between discovery and fixing of a bug.
1.4.2. Linux Cons
- There are far too many different distributions:
"Quot capites, tot rationes", as the Romans already said: the more people, the more opinions. At first glance, the amount of Linux distributions can be frightening, or ridiculous, depending on your point of view. But it also means that everyone will find what he or she needs. You don't need to be an expert to find a suitable release.
When asked, generally every Linux user will say that the best distribution is the specific version he is using. So which one should you choose? Don't worry too much about that: all releases contain more or less the same set of basic packages. On top of the basics, special third party software is added making, for example, TurboLinux more suitable for the small and medium enterprise, RedHat for servers and SuSE for workstations. However, the differences are likely to be very superficial. The best strategy is to test a couple of distributions; unfortunately not everybody has the time for this. Luckily, there is plenty of advice on the subject of choosing your Linux. A quick search on Google, using the keywords "choosing your distribution" brings up tens of links to good advise. The Installation HOWTO also discusses choosing your distribution. - Linux is not very user friendly and confusing for beginners:
It must be said that Linux, at least the core system, is less userfriendly to use than MS Windows and certainly more difficult than MacOS, but... In light of its popularity, considerable effort has been made to make Linux even easier to use, especially for new users. More information is being released daily, such as this guide, to help fill the gap for documentation available to users at all levels. - Is an Open Source product trustworthy?
How can something that is free also be reliable? Linux users have the choice whether to use Linux or not, which gives them an enormous advantage compared to users of proprietary software, who don't have that kind of freedom. After long periods of testing, most Linux users come to the conclusion that Linux is not only as good, but in many cases better and faster that the traditional solutions. If Linux were not trustworthy, it would have been long gone, never knowing the popularity it has now, with millions of users. Now users can influence their systems and share their remarks with the community, so the system gets better and better every day. It is a project that is never finished, that is true, but in an ever changing environment, Linux is also a project that continues to strive for perfection.
Linux Basic Commands
Linux operating system has a beautiful graphical interface which most of us will be using. It will be good to learn the basic commands in Linux to work interactively with the Linux operating system. Linux has a back end access know as shell. You can control and activate all the process in Linux from the shell. So it is very important to learn few basic commands to work with Linux operating system.
Navigation Commands - [ pwd, cd ]
pwd
This command is used to find the current location or current working directory.
This command is used to find the current location or current working directory.
Eg:
[user@ws26 ~]$ pwd
/home/user
[user@ws26 ~]$ pwd
/home/user
cd
This command id used to change the directory. You can move from one directory to another using this command. Few examples are given below.
This command id used to change the directory. You can move from one directory to another using this command. Few examples are given below.
Concider you have a directory structure /home/user/test/test1/ . test and test1 are directories in user home.
Example 1:
Consider you have a directory "test" in /home/user. Your current working directory is /home/user. You want to change your current working directory from /home/user to /home/user/test, use the following command
[user@ws26 ~]$ pwd
/home/user
[user@ws26 ~]$ cd test
[user@ws26 ~]$ pwd
/home/user/test
Consider you have a directory "test" in /home/user. Your current working directory is /home/user. You want to change your current working directory from /home/user to /home/user/test, use the following command
[user@ws26 ~]$ pwd
/home/user
[user@ws26 ~]$ cd test
[user@ws26 ~]$ pwd
/home/user/test
Example 2:
If you want to move back to /home/user, use the following command
[user@ws26 ~]$ cd ..
[user@ws26 ~]$ pwd
/home/user
If you want to move back to /home/user, use the following command
[user@ws26 ~]$ cd ..
[user@ws26 ~]$ pwd
/home/user
Example 3:
To get back to the home directory of the user
[user@ws26 ~]$ cd ~
[user@ws26 ~]$ pwd
/home/user.
To get back to the home directory of the user
[user@ws26 ~]$ cd ~
[user@ws26 ~]$ pwd
/home/user.
Listing contents in a directory - [ ls, ls -l, ll ]Listing contents in a directory - [ ls, ls -l, ll ]
ls
This command is used to list all the files and directory in the current directory.
This command is used to list all the files and directory in the current directory.
Eg:
[user@ws26 ~]$ ls
1152696870.jpg book OperaDownloads snapshot52.png
image300.jpg Desktop test spiderman2.jpg
[user@ws26 ~]$ ls
1152696870.jpg book OperaDownloads snapshot52.png
image300.jpg Desktop test spiderman2.jpg
ls -l or ll
This command is also used to list all the files and directories. Here you will get more details about the files and directories present in the current directory. You will see the permission set, creation date, file / directory size etc.
This command is also used to list all the files and directories. Here you will get more details about the files and directories present in the current directory. You will see the permission set, creation date, file / directory size etc.
Eg:
[user@ws26 ~]$ ls -l
total 5
-rw-rw-r-- 1 user user 33188 Dec 22 02:56 1152696870.jpg
-rw-rw-r-- 1 user user 17647 Aug 19 2006 534458.gif
-rw-rw-r-- 1 user user 26817 Aug 19 2006 534477.gif
drwxrwxr-x 2 user user 4096 Jan 13 04:20 book
drwx------ 3 user user 4096 Feb 4 02:34 Desktop
[user@ws26 ~]$ ls -l
total 5
-rw-rw-r-- 1 user user 33188 Dec 22 02:56 1152696870.jpg
-rw-rw-r-- 1 user user 17647 Aug 19 2006 534458.gif
-rw-rw-r-- 1 user user 26817 Aug 19 2006 534477.gif
drwxrwxr-x 2 user user 4096 Jan 13 04:20 book
drwx------ 3 user user 4096 Feb 4 02:34 Desktop
Reading files in Linux - [ cat, more, less ]
at
This command is used to display the contents of a file. You can read the file contents using the cat command.
This command is used to display the contents of a file. You can read the file contents using the cat command.
Example:
[user@ws26 ~]$ cat testfile
this is a test file.. You can read me..
[user@ws26 ~]$ cat testfile
this is a test file.. You can read me..
Less and More
Both the less and more commands serve similar function. They are used to display file one screen at a time. You can press spacebar to continue reading the file. These commands are mainly used while reading large files.
Both the less and more commands serve similar function. They are used to display file one screen at a time. You can press spacebar to continue reading the file. These commands are mainly used while reading large files.
Example 1:
[user@ws26 ~]$ less testfile
this is a test file.. You can read me..
[user@ws26 ~]$ less testfile
this is a test file.. You can read me..
Example 2:
[user@ws26 ~]$ more testfile
this is a test file.. You can read me..
[user@ws26 ~]$ more testfile
this is a test file.. You can read me..
Manipulating files - [ cp, mv, rm, mkdir ]
cp
This command is used to copy files/directory.
This command is used to copy files/directory.
Example:
[user@ws26 ~]$ cp file1 directory1
This will copy the file1 into the directory1
[user@ws26 ~]$ cp file1 directory1
This will copy the file1 into the directory1
cp -R
This command is used to copy directories recursively (copy all the files and folders inside the directory).
This command is used to copy directories recursively (copy all the files and folders inside the directory).
Example:
[user@ws26 ~]$ cp directory2 directory1
This will copy the whole directory2 into directory1
[user@ws26 ~]$ cp directory2 directory1
This will copy the whole directory2 into directory1
mv
This command is used to move the file or directory.
This command is used to move the file or directory.
Example:
[user@ws26 ~]$ mv directory2 directory1
This will move the whole directory2 into directory1
[user@ws26 ~]$ mv directory2 directory1
This will move the whole directory2 into directory1
rm
This command is used to remove or delete files and directories.
This command is used to remove or delete files and directories.
Example:
[user@ws26 ~]$ rm directory2
This will delete the directory - directory2
[user@ws26 ~]$ rm directory2
This will delete the directory - directory2
mkdir
This command is used to create a new directory
This command is used to create a new directory
Example:
[user@ws26 ~]$ mkdir directory3
This will create a new directory - directory3.
[user@ws26 ~]$ mkdir directory3
This will create a new directory - directory3.
Create new file in Linux - vi editor
The Vi editor is mainly used to create new files in Linux.
Example:
vi testfile
The command will open a new window and you can insert text to it. To begin press "i". After adding your contect press ":wq" to save the file.
Example:
vi testfile
The command will open a new window and you can insert text to it. To begin press "i". After adding your contect press ":wq" to save the file.
LINUX BASICS
Linux is an Open Source, free Operating System created by Linus Torvalds. For more information, please see our General Information page.
The Linux kernel is the core of the Linux operating system. To find out which version of the Linux kernel you are running, simply type uname -r in a terminal. For more information on the Linux kernel, please visit http://www.kernel.org. For information on how to install or compile the Linux Kernel, please see our Kernel Compile/Upgrade Guide.
One of the pleasures of running linux is choice. The choice of which Linux Distribution you wish to run is 100% up to you. You can browse ourDistributions Page for comparisons of the various distributions out there. If you are totally new to linux we suggest you start off with either Red Hat Linux or Mandrake Linux as they are easier to install, configure and maintain.
The root user is the master user or systems adminstrator of the machine. The root user has full access to all files and directories, which is why you will only want to use the root account to perform system maintainance or to install applications.
In order to reboot your machine, you must instruct the Linux kernel to stop all the processes (programs) it's currently running. Do not simply press the reboot button on the front of your computer case, as Linux must be properly shut down/restarted. To restart your machine, as root, run either of the following commands in a terminal:
reboot
shutdown -r now
On most systems you can also press (all at once) the control, alt and delete keys.
In order to shut down your machine, you must instruct the Linux kernel to stop all the processes (programs) it's currently running. Do not simply press the power off button on the front of your computer case, as Linux must be properly shut down/restarted. To shut down your machine, as root, run either of the following commands in a terminal:
halt
shutdown -h now
If you want to remove the Lilo or Grub boot loader from your system (if you are uninstalling linux etc) follow the procedures below:
For Windows 95/98 etc:
Use a dos boot disk and at the command prompt type:
fdisk /mbr
For Windows XP:
Boot off the XP Installation CD and go into rescue mode. From there run the command:
fixmbr
While logged in as root, type adduser username at the shell prompt, replacing username with the name you want to use to log in. You can create as many users as you wish, one for each member of your family, for example.
While logged in as root, type userdel username at the shell prompt, replacing username with the user name you wish to delete.
To set the password for a specific user, type (while logged in as root) passwd username at the shell prompt, replacing username with the name of the person who's password you wish to change. By typing just passwd you'll be able to change the password of the user under who's name you're currently logged in as. Do not use passwords which are easy to guess, like your middle name or your pets name.
cd - Used to change directories
Usage: cd [directory]
Example: cd /home/joey/html
Example: cd ../ (to move back one directory)
Example: cd (to return to your home directory)
For more information, in a terminal, type man cd
cp - Used to copy files/directories from one location to another
Usage: cp file newlocation
Example: cp /home/joey/index.html /var/www/index.html
Example: cp /home/joey/* /var/www/ (this will copy everything in /home/joey to /var/www/)
For more information, in a terminal, type man cp
mv - Used to move or rename files
Usage: mv file location (to move)
Usage: mv filename newfilename (to rename)
Example: mv index.html /var/www/index.html (to move)
Example: mv index.html index2.html (rename)
For more information, in a terminal, type man mv
- How do I move files?
mv - Used to move or rename files
Usage: mv file location (to move)
Usage: mv filename newfilename (to rename)
Example: mv index.html /var/www/index.html (to move)
Example: mv index.html index2.html (rename)
For more information, in a terminal, type man mv
The default editor that ships with almost every distribution of Linux is Vi. This editor is slightly advanced and confuses most newbies. We suggest starting off with Pico, a more simple editor. Pico is part of the Pine software package which can be downloaded athttp://www.washington.edu/pine (It might already be installed on your system). To edit a file with pico, simply run:
pico filename
This will open up the file and allow to you edit it. At the bottom of the screen you will notice the various commands that you have access to with Pico. If you wish to save the file and exit, simply hold down the control key and hit the x key on your keyboard.
ls - To list the contents of a directory
Usage: ls [flags] directory
Example: ls (To list the current directory)
Example: ls /home/joey (To list the contents of /home/joey)
Example: ls -a (To list hidden files)
Example: ls -l (To list file/directory permissions and file sizes)
Example: ls -al /home/joey (To list all files and permissions in /home/joey)
For more information, in a terminal, type man ls
To delete a file you must first have write permission to it. For information about permissions, click here. Once you have write permission, in a terminal run:
rm filename
There is no "Recycle Bin" in Linux so once you delete a file, it's gone for good.
When removing files, you may use an astrix (*) as a wildcard flag to remove certain files, for example if I wanted to remove all files that began with the letter j, I would run rm j*
If anyone tells you to run rm -rf / as root, DO NOT LISTEN TO THEM. Running this command will delete all the files/directories on your Linux system.
If you have ownership to the directory and the directory is empty, you can simply type rmdir directoryname to remove the directory. If the directory is not empty and you wish to simply delete it and all its contents, run rm -rf directoryname
Please be careful with the -rf flag, as it will remove everything in the specified directory including sub directories. With root access and the rm -rf command you can wipe out your entire system if you make an error.
Linux requires you to mount your cdrom/floppy drives when you wish to use them. On most Linux distributions, the mount command will require root access. Depending on which Linux distribution you run, one of the following commands should mount your cdrom drive. As root, run:
mount /dev/cdrom /mnt/cdrom
mount /dev/cdrom /cdrom
Linux requires you to mount your cdrom/floppy drives when you wish to use them. On most Linux distributions, the mount command will require root access. Depending on which Linux distribution you run, one of the following commands should mount your floppy drive. As root, run:
mount /dev/fd0 /mnt/floppy
mount /dev/fd0 /floppy
One of the great features of Linux is that it is a multi-user system. With multi-users, it allows certain users to own files and directories so nobody else can access/modify them, for example your /home directory. To change the ownership of a file/directory, as root execute the following command in a terminal:
chown username. filename/directory
This will change the ownership and group ownership of the specified file or directory to the specified user. For more information, in a terminal, type man chown
There are 3 different attributes a file can have that make up the permissions for the file.
There is read access that allows users to read the file.
There is write access that allows users to modify the file.
There is executable access that allows users to execute the file.
From
these three attributes, you now have three different levels of permissions, the
first being for the owner of the file, the second being for the group the file
belongs to and the third being all other users on the system.
To
view the current permissions on files and directories run the following
command:
ls -l and you should see something that looks like:
ls -l and you should see something that looks like:
drwxrwxr-x 3 joey
html 4096 Sep 12 2000 images/
-rw-rw-r-- 1 joey
html 267 Aug 8 12:55 index.shtml
The
above shows you that images is a directory (d) and that the owner and group
(joey html) have read (r), write (w) and execute (x) permissions while other
users on the system only have read (r) and execute (x) permissions.
For the index.shtml file, it shows joey and html as the owner and group and they both have read and write access to the file. It also shows that other users on the system only have read access. Note there is no executable permission since the file is not an executable.
For the index.shtml file, it shows joey and html as the owner and group and they both have read and write access to the file. It also shows that other users on the system only have read access. Note there is no executable permission since the file is not an executable.
To
modify the permissions on a file, you either have to own it or be logged in as
root. To modify the permissions, in a terminal type:
chmod xxx filename/directory
You will have to replace the xxx flags with the permissions you wish to change. You can either go by the numerical value or by the actuals.
Some common numerical values are:
755 - Read, Write, Execute for owner, read, execute for group and other.
644 - Read, Write for owner, read for group and other.
666 - Read, Write for all.
700 - Read, Write, Execute for owner, nothing for group, other.
So if you wanted to make a file an executable for your user and other users on the system, you would run the following:
chmod 755 somefile
For more information, in a terminal, type man chmod
chmod xxx filename/directory
You will have to replace the xxx flags with the permissions you wish to change. You can either go by the numerical value or by the actuals.
Some common numerical values are:
755 - Read, Write, Execute for owner, read, execute for group and other.
644 - Read, Write for owner, read for group and other.
666 - Read, Write for all.
700 - Read, Write, Execute for owner, nothing for group, other.
So if you wanted to make a file an executable for your user and other users on the system, you would run the following:
chmod 755 somefile
For more information, in a terminal, type man chmod
There are two methods to search for files on your Linux machine, one method being the locate command and the other being the find command. If you wish to use the locate command, you must first update the locate database by running the following command in a terminal as root:
/usr/bin/updatedb
This will create an index of all the files and their locations on your hard drive. Once updatedb has completed running, you may now search your drive for a specific file by running the following command in a terminal:
/usr/bin/locate filename
Another
way to search your linux system is with the find command. To find a file on
your sytem with the find command, in a terminal run the follwoing:
/usr/bin/find / -name filename Be sure to replace "filename" with the actual name of the file.
/usr/bin/find / -name filename Be sure to replace "filename" with the actual name of the file.
To extract .tar.gz or .tgz files, run the following command in a terminal:
tar -zxvf file.tar.gz (or file.tgz)
This will normally create a new directory based on the filename. If you want to extract a filename called file.tar (without the .gz) simply run:
tar -xvf file.tar
For more information, in a terminal, type man tar
To extract .bz2 files, run the following command in a terminal:
bunzip2 -dv file.bz2
This will normally create a new directory based on the filename. For more information, in a terminal, type man buznip2
There are many ways to install applications in Linux. If the file you wish to install is in .rpm format and you are running an RPM based distribution such as Red Hat, Mandrake or SuSE, run the following command as root in a shell prompt/terminal:
rpm -Uvh filename.rpm
If
you are running Debian
GNU/Linux and you wish to install a .deb file, you can do so by
running the following command in a terminal as root:
dpkg -i filename.deb or apt-get install package (if you have APT already installed/configured).
dpkg -i filename.deb or apt-get install package (if you have APT already installed/configured).
If
the file you with to install is in a .tar.gz, .tgz or .bz2 format, you will
first have to decompress (unzip) the file. Once the file has been unziped, it
should create a directory based on the filename. Simply change into that
directory and open up the README or INSTALL file in a text editor and follow
the installation instructions.
To run a program, you must first make sure it has executable permissions set. For more information on permissions, see How do I view/change permissions on files/directories? above. Once the file has executable permissions, simply run the filename from a terminal. I will use the filename "irc" as an example
Example: /usr/bin/irc (from anywhere on the system)
Example: ./irc (from the /usr/bin directory)
Subscribe to:
Posts (Atom)