Archive

Archive for the ‘Linux’ Category

Red Hat Linux Customization Guide

January 29th, 2009 No comments

 

Source: http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/index.html

 

 

docs_header

Red Hat Docs > Manuals > Red Hat Linux Manuals > Red Hat Linux 9 >

 

Red Hat Linux 9

Red Hat Linux Customization Guide

Copyright © 2003 by Red Hat, Inc.

ISBN: N/A


Table of Contents
Introduction
1. Changes to This Manual
2. Document Conventions
3. More to Come
3.1. Send in Your Feedback
4. Sign Up for Support
I. File Systems
1. The ext3 File System
1.1. Features of ext3
1.2. Creating an ext3 File System
1.3. Converting to an ext3 File System
1.4. Reverting to an ext2 File System
2. Swap Space
2.1. What is Swap Space?
2.2. Adding Swap Space
2.3. Removing Swap Space
2.4. Moving Swap Space
3. Redundant Array of Independent Disks (RAID)
3.1. What is RAID?
3.2. Who Should Use RAID?
3.3. Hardware RAID versus Software RAID
3.4. RAID Levels and Linear Support
4. Logical Volume Manager (LVM)
5. Managing Disk Storage
5.1. Viewing the Partition Table
5.2. Creating a Partition
5.3. Removing a Partition
5.4. Resizing a Partition
6. Implementing Disk Quotas
6.1. Configuring Disk Quotas
6.2. Managing Disk Quotas
6.3. Additional Resources
II. Installation-Related Information
7. Kickstart Installations
7.1. What are Kickstart Installations?
7.2. How Do You Perform a Kickstart Installation?
7.3. Creating the Kickstart File
7.4. Kickstart Options
7.5. Package Selection
7.6. Pre-installation Script
7.7. Post-installation Script
7.8. Making the Kickstart File Available
7.9. Making the Installation Tree Available
7.10. Starting a Kickstart Installation
8. Kickstart Configurator
8.1. Basic Configuration
8.2. Installation Method
8.3. Boot Loader Options
8.4. Partition Information
8.5. Network Configuration
8.6. Authentication
8.7. Firewall Configuration
8.8. X Configuration
8.9. Package Selection
8.10. Pre-Installation Script
8.11. Post-Installation Script
8.12. Saving the File
9. Basic System Recovery
9.1. Common Problems
9.2. Booting into Rescue Mode
9.3. Booting into Single-User Mode
9.4. Booting into Emergency Mode
10. Software RAID Configuration
11. LVM Configuration
III. Network-Related Configuration
12. Network Configuration
12.1. Overview
12.2. Establishing an Ethernet Connection
12.3. Establishing an ISDN Connection
12.4. Establishing a Modem Connection
12.5. Establishing an xDSL Connection
12.6. Establishing a Token Ring Connection
12.7. Establishing a CIPE Connection
12.8. Establishing a Wireless Connection
12.9. Managing DNS Settings
12.10. Managing Hosts
12.11. Activating Devices
12.12. Working with Profiles
12.13. Device Aliases
13. Basic Firewall Configuration
13.1. Security Level Configuration Tool
13.2. GNOME Lokkit
13.3. Activating the iptables Service
14. Controlling Access to Services
14.1. Runlevels
14.2. TCP Wrappers
14.3. Services Configuration Tool
14.4. ntsysv
14.5. chkconfig
14.6. Additional Resources
15. OpenSSH
15.1. Why Use OpenSSH?
15.2. Configuring an OpenSSH Server
15.3. Configuring an OpenSSH Client
15.4. Additional Resources
16. Network File System (NFS)
16.1. Why Use NFS?
16.2. Mounting NFS File Systems
16.3. Exporting NFS File Systems
16.4. Additional Resources
17. Samba
17.1. Why Use Samba?
17.2. Configuring a Samba Server
17.3. Connecting to a Samba Share
17.4. Additional Resources
18. Dynamic Host Configuration Protocol (DHCP)
18.1. Why Use DHCP?
18.2. Configuring a DHCP Server
18.3. Configuring a DHCP Client
18.4. Additional Resources
19. Apache HTTP Server Configuration
19.1. Basic Settings
19.2. Default Settings
19.3. Virtual Hosts Settings
19.4. Server Settings
19.5. Performance Tuning
19.6. Saving Your Settings
19.7. Additional Resources
20. Apache HTTP Secure Server Configuration
20.1. Introduction
20.2. An Overview of Security-Related Packages
20.3. An Overview of Certificates and Security
20.4. Using Pre-Existing Keys and Certificates
20.5. Types of Certificates
20.6. Generating a Key
20.7. Generating a Certificate Request to Send to a CA
20.8. Creating a Self-Signed Certificate
20.9. Testing The Certificate
20.10. Accessing The Server
20.11. Additional Resources
21. BIND Configuration
21.1. Adding a Forward Master Zone
21.2. Adding a Reverse Master Zone
21.3. Adding a Slave Zone
22. Authentication Configuration
22.1. User Information
22.2. Authentication
22.3. Command Line Version
23. Mail Transport Agent (MTA) Configuration
IV. System Configuration
24. Console Access
24.1. Disabling Shutdown Via Ctrl-Alt-Del
24.2. Disabling Console Program Access
24.3. Disabling All Console Access
24.4. Defining the Console
24.5. Making Files Accessible From the Console
24.6. Enabling Console Access for Other Applications
24.7. The floppy Group
25. User and Group Configuration
25.1. Adding a New User
25.2. Modifying User Properties
25.3. Adding a New Group
25.4. Modifying Group Properties
25.5. Command Line Configuration
25.6. Explaining the Process
26. Gathering System Information
26.1. System Processes
26.2. Memory Usage
26.3. File Systems
26.4. Hardware
26.5. Additional Resources
27. Printer Configuration
27.1. Adding a Local Printer
27.2. Adding an IPP Printer
27.3. Adding a Remote UNIX (LPD) Printer
27.4. Adding a Samba (SMB) Printer
27.5. Adding a Novell NetWare (NCP) Printer
27.6. Adding a JetDirect Printer
27.7. Selecting the Printer Model and Finishing
27.8. Printing a Test Page
27.9. Modifying Existing Printers
27.10. Saving the Configuration File
27.11. Command Line Configuration
27.12. Managing Print Jobs
27.13. Sharing a Printer
27.14. Switching Print Systems
27.15. Additional Resources
28. Automated Tasks
28.1. Cron
28.2. Anacron
28.3. At and Batch
28.4. Additional Resources
29. Log Files
29.1. Locating Log Files
29.2. Viewing Log Files
29.3. Examining Log Files
30. Upgrading the Kernel
30.1. The 2.4 Kernel
30.2. Preparing to Upgrade
30.3. Downloading the Upgraded Kernel
30.4. Performing the Upgrade
30.5. Verifying the Initial RAM Disk Image
30.6. Verifying the Boot Loader
31. Kernel Modules
31.1. Kernel Module Utilities
31.2. Additional Resources
V. Package Management
32. Package Management with RPM
32.1. RPM Design Goals
32.2. Using RPM
32.3. Checking a Package’s Signature
32.4. Impressing Your Friends with RPM
32.5. Additional Resources
33. Package Management Tool
33.1. Installing Packages
33.2. Removing Packages
34. Red Hat Network
VI. Appendixes
A. Building a Custom Kernel
A.1. Preparing to Build
A.2. Building the Kernel
A.3. Building a Monolithic Kernel
A.4. Additional Resources
B. Getting Started with Gnu Privacy Guard
B.1. Configuration File
B.2. Warning Messages
B.3. Generating a Keypair
B.4. Generating a Revocation Certificate
B.5. Exporting your Public Key
B.6. Importing a Public Key
B.7. What Are Digital Signatures?
B.8. Additional Resources
Index
Colophon
Categories: Linux Tags:

Apache HTTP Server Configuration (Red Hat Linux)

January 29th, 2009 No comments

 

Source: http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/ch-httpdconfig.html 

 

docs_header

In Red Hat Linux 8.0, the Apache HTTP Server was updated to version 2.0, which uses different configuration options. Also starting with Red Hat Linux 8.0, the RPM package was renamed httpd. If you want to migrate an existing configuration file by hand, refer to the migration guide at /usr/share/doc/httpd-<ver>/migration.html or the Red Hat Linux Reference Guide for details.

If you configured the Apache HTTP Server with the HTTP Configuration Tool in previous versions of Red Hat Linux and then performed an upgrade, you can use the application to migrate the configuration file to the new format for version 2.0. Start the HTTP Configuration Tool, make any changes to the configuration, and save it. The configuration file saved will be compatible with version 2.0.

The HTTP Configuration Tool allows you to configure the /etc/httpd/conf/httpd.conf configuration file for the Apache HTTP Server. It does not use the old srm.conf or access.conf configuration files; leave them empty. Through the graphical interface, you can configure directives such as virtual hosts, logging attributes, and maximum number of connections.

Only modules that are shipped with Red Hat Linux can be configured with HTTP Configuration Tool. If additional modules are installed, they can not be configured using this tool.

The httpd and redhat-config-httpd RPM packages need to be installed to use the HTTP Configuration Tool. It also requires the X Window System and root access. To start the application, go to the Main Menu Button => System Settings => Server Settings => HTTP Server or type the command redhat-config-httpd at a shell prompt (for example, in an XTerm or GNOME Terminal).

caution
Caution

Do not edit the /etc/httpd/conf/httpd.conf configuration file by hand if you wish to use this tool. The HTTP Configuration Tool generates this file after you save your changes and exit the program. If you want to add additional modules or configuration options that are not available in HTTP Configuration Tool, you cannot use this tool.

The general steps for configuring the Apache HTTP Server using the HTTP Configuration Tool are as following:

  1. Configure the basic settings under the Main tab.

  2. Click on the Virtual Hosts tab and configure the default settings.

  3. Under the Virtual Hosts tab, configure the Default Virtual Host.

  4. If you want to serve more than one URL or virtual host, add the additional virtual hosts.

  5. Configure the server settings under the Server tab.

  6. Configure the connections settings under the Performance Tuning tab.

  7. Copy all necessary files to the DocumentRoot and cgi-bin directories.

  8. Exit the application and select to save your settings.

Basic Settings

Use the Main tab to configure the basic server settings.

httpd-main

Figure Basic Settings

Enter a fully qualified domain name that you have the right to use in the Server Name text area. This option corresponds to the ServerName directive in httpd.conf. The ServerName directive sets the hostname of the Web server. It is used when creating redirection URLs. If you do not define a server name, the Web server attempts to resolve it from the IP address of the system. The server name does not have to be the domain name resolved from the IP address of the server. For example, you might want to set the server name to www.example.com when your server’s real DNS name is actually foo.example.com.

Enter the email address of the person who maintains the Web server in the Webmaster email address text area. This option corresponds to the ServerAdmin directive in httpd.conf. If you configure the server’s error pages to contain an email address, this email address will be used so that users can report a problem by sending email to the server’s administrator. The default value is root@localhost.

Use the Available Addresses area to define the ports on which the server will accept incoming requests. This option corresponds to the Listen directive in httpd.conf. By default, Red Hat configures the Apache HTTP Server to listen to port 80 for non-secure Web communications.

Click the Add button to define additional ports on which to accept requests. A window as shown in Figure 19-2 will appear. Either choose the Listen to all addresses option to listen to all IP addresses on the defined port or specify a particular IP address over which the server will accept connections in the Address field. Only specify one IP address per port number. If you want to specify more than one IP address with the same port number, create an entry for each IP address. If at all possible, use an IP address instead of a domain name to prevent a DNS lookup failure. Refer to http://httpd.apache.org/docs-2.0/dns-caveats.html for more information about Issues Regarding DNS and Apache.

Entering an asterisk (*) in the Address field is the same as choosing Listen to all addresses. Clicking the Edit button in the Available Addresses frame shows the same window as the Add button except with the fields populated for the selected entry. To delete an entry, select it and click the Delete button.

tip
Tip

If you set the server to listen to a port under 1024, you must be root to start it. For port 1024 and above, httpd can be started as a regular user.

httpd-listen

Default Settings

After defining the Server Name, Webmaster email address, and Available Addresses, click the Virtual Hosts tab and click the Edit Default Settings button. The window shown in Figure 19-3 will appear. Configure the default settings for your Web server in this window. If you add a virtual host, the settings you configure for the virtual host take precedence for that virtual host. For a directive not defined within the virtual host settings, the default value is used.

Site Configuration

The default values for the Directory Page Search List and Error Pages will work for most servers. If you are unsure of these settings, do not modify them.

httpd-siteconfig

Figure Site Configuration

The entries listed in the Directory Page Search List define the DirectoryIndex directive. The DirectoryIndex is the default page served by the server when a user requests an index of a directory by specifying a forward slash (/) at the end of the directory name.

For example, when a user requests the page http://www.example.com/this_directory/, they are going to get either the DirectoryIndex page if it exists, or a server-generated directory list. The server will try to find one of the files listed in the DirectoryIndex directive and will return the first one it finds. If it does not find any of these files and if Options Indexes is set for that directory, the server will generate and return a list, in HTML format, of the subdirectories and files in the directory.

Use the Error Code section to configure Apache HTTP Server to redirect the client to a local or external URL in the event of a problem or error. This option corresponds to the ErrorDocument directive. If a problem or error occurs when a client tries to connect to the Apache HTTP Server, the default action is to display the short error message shown in the Error Code column. To override this default configuration, select the error code and click the Edit button. Choose Default to display the default short error message. Choose URL to redirect the client to an external URL and enter a complete URL including the http:// in the Location field. Choose File to redirect the client to an internal URL and enter a file location under the document root for the Web server. The location must begin the a slash (/) and be relative to the Document Root.

For example, to redirect a 404 Not Found error code to a webpage that you created in a file called 404.html, copy 404.html to DocumentRoot/../error/404.html. In this case, DocumentRoot is the Document Root directory that you have defined (the default is /var/www/html/). If the Document Root is left as the default location, the file should be copied to /var/www/error/404.html. Then, choose File as the Behavior for 404 – Not Found error code and enter /error/404.html as the Location.

From the Default Error Page Footer menu, you can choose one of the following options:

  • Show footer with email address — Display the default footer at the bottom of all error pages along with the email address of the website maintainer specified by the ServerAdmin directive. Refer to Section 19.3.1.1 General Options for information about configuring the ServerAdmin directive.

  • Show footer — Display just the default footer at the bottom of error pages.

  • No footer — Do not display a footer at the bottom of error pages.

Logging

By default, the server writes the transfer log to the file /var/log/httpd/access_log and the error log to the /var/log/httpd/error_log file.

The transfer log contains a list of all attempts to access the Web server. It records the IP address of the client that is attempting to connect, the date and time of the attempt, and the file on the Web server that it is trying to retrieve. Enter the name of the path and file in which to store this information. If the path and filename does not start with a slash (/), the path is relative to the server root directory as configured. This option corresponds to the TransferLog directive.

httpd-logging

Figure Logging

You can configure a custom log format by checking Use custom logging facilities and entering a custom log string in the Custom Log String field. This configures the LogFormat directive. Refer to http://httpd.apache.org/docs-2.0/mod/mod_log_config.html#formats for details on the format of this directive.

The error log contains a list of any server errors that occur. Enter the name of the path and file in which to store this information. If the path and filename does not start with a slash (/), the path is relative to the server root directory as configured. This option corresponds to the ErrorLog directive.

Use the Log Level menu to set how verbose the error messages in the error logs will be. It can be set (from least verbose to most verbose) to emerg, alert, crit, error, warn, notice, info or debug. This option corresponds to the LogLevel directive.

The value chosen with the Reverse DNS Lookup menu defines the HostnameLookups directive. Choosing No Reverse Lookup sets the value to off. Choosing Reverse Lookup sets the value to on. Choosing Double Reverse Lookup sets the value to double.

If you choose Reverse Lookup, your server will automatically resolve the IP address for each connection which requests a document from your Web server. Resolving the IP address means that your server will make one or more connections to the DNS in order to find out the hostname that corresponds to a particular IP address.

If you choose Double Reverse Lookup, your server will perform a double-reverse DNS. In other words, after a reverse lookup is performed, a forward lookup is performed on the result. At least one of the IP addresses in the forward lookup must match the address from the first reverse lookup.

Generally, you should leave this option set to No Reverse Lookup, because the DNS requests add a load to your server and may slow it down. If your server is busy, the effects of trying to perform these reverse lookups or double reverse lookups may be quite noticeable.

Reverse lookups and double reverse lookups are also an issue for the Internet as a whole. All of the individual connections made to look up each hostname add up. Therefore, for your own Web server’s benefit, as well as for the Internet’s benefit, you should leave this option set to No Reverse Lookup.

Environment Variables

Sometimes it is necessary to modify environment variables for CGI scripts or server-side include (SSI) pages. The Apache HTTP Server can use the mod_env module to configure the environment variables which are passed to CGI scripts and SSI pages. Use the Environment Variables page to configure the directives for this module.

httpd-environment

Figure Environment Variables

Use the Set for CGI Scripts section to set an environment variable that is passed to CGI scripts and SSI pages. For example, to set the environment variable MAXNUM to 50, click the Add button inside the Set for CGI Script section as shown in Figure 19-5 and type MAXNUM in the Environment Variable text field and 50 in the Value to set text field. Click OK to add it to the list. The Set for CGI Scripts section configures the SetEnv directive.

Use the Pass to CGI Scripts section to pass the value of an environment variable when the server was first started to CGI scripts. To see this environment variable, type the command env at a shell prompt. Click the Add button inside the Pass to CGI Scripts section and enter the name of the environment variable in the resulting dialog box. Click OK to add it to the list. The Pass to CGI Scripts section configures the PassEnv directive.

If you want to remove an environment variable so that the value is not passed to CGI scripts and SSI pages, use the Unset for CGI Scripts section. Click Add in the Unset for CGI Scripts section, and enter the name of the environment variable to unset. Click OK to add it to the list. This corresponds to the UnsetEnv directive.

To edit any of these environment values, select it from the list and click the corresponding Edit button. To delete any entry from the list, select it and click the cooresponding Delete button.

To learn more about environment variables in Apache HTTP Server, refer to the following:

http://httpd.apache.org/docs-2.0/env.html

Directories

Use the Directories page to configure options for specific directories. This corresponds to the <Directory> directive.

httpd-directories

Figure Directories

Click the Edit button in the top right-hand corner to configure the Default Directory Options for all directories that are not specified in the Directory list below it. The options that you choose are listed as the Options directive within the <Directory> directive. You can configure the following options:

  • ExecCGI — Allow execution of CGI scripts. CGI scripts are not executed if this option is not chosen.

  • FollowSymLinks — Allow symbolic links to be followed.

  • Includes — Allow server-side includes.

  • IncludesNOEXEC — Allow server-side includes, but disable the #exec and #include commands in CGI scripts.

  • Indexes — Display a formatted list of the directory’s contents, if no DirectoryIndex (such as index.html) exists in the requested directory.

  • Multiview — Support content-negotiated multiviews; this option is disabled by default.

  • SymLinksIfOwnerMatch — Only follow symbolic links if the target file or directory has the same owner as the link.

To specify options for specific directories, click the Add button beside the Directory list box. The window shown in Figure 19-7 appears. Enter the directory to configure in the Directory text field at the bottom of the window. Select the options in the right-hand list, and configure the Order directive with the left-hand side options. The Order directive controls the order in which allow and deny directives are evaluated. In the Allow hosts from and Deny hosts from text field, you can specify one of the following:

  • Allow all hosts — Type all to allow access to all hosts.

  • Partial domain name — Allow all hosts whose names match or end with the specified string.

  • Full IP address — Allow access to a specific IP address.

  • A subnet — Such as 192.168.1.0/255.255.255.0

  • A network CIDR specification — such as 10.3.0.0/16

httpd-directories-add

Figure Directory Settings

If you check the Let .htaccess files override directory options, the configuration directives in the .htaccess file take precedence.

Categories: Linux, Web Server Tags:

How to Install RHEL 4 or CentOS 4 Linux

January 26th, 2009 No comments

 

Source: http://www.linuxmail.info/how-to-install-centos-4-linux

 

After getting a copy of the CentOS 4 Linux or Red Hat Enterprise Linux 4, the steps below describes how to install it from scratch.

boot

1. Boot your computer from the CentOS 4 CD 1 and press Enter on the CentOS boot up screen. This will install CentOS in graphical mode.

cd-check

2. Choose Skip in the CD Found window. This will skip the CD media test.

welcome

3. Click Next in the Welcome to CentOS-4 i386 window.

language-selection

4. Choose a language in the Language Selection window and click Next.

keyboard-config

5. Choose a keyboard in the Keyboard Configuration window and click Next.

installation-type

6. Choose Server in the Installation Type window and click Next.

disk-partitioning

7. Click Next in the Disk Partitioning Setup window and answer Yes on the Warning window.

auto-partitioning 8. Click Next in the Automatic Partitioning window and answer Yes on the Warning window.

disk-setup

9. Click Next in the Disk Setup window.

The automatically generated partitions works fine but you can fine tune it from this window. Learn more about Linux partitions here.

boot-loader

10. Click Next in the Boot Loader Configuration window.

network-config1

11. Configure your network setting in the Network Configuration window.

Let’s say you have a network settings like the one below

Host Name

mail.acme.local

IP Address

192.168.0.4

Subnet Mask

255.255.255.0

Gateway

192.168.0.1

Primary DNS

192.168.0.1

Secondary DNS

192.168.0.2

Tertiary DNS

192.168.0.3

network-config2

First, click the Edit button. In the Edit Interface eth0 window, uncheck the Configure using DHCP and fill up the IP Address and Netmask. Click OK when you’re done.

network-config3

Next fill in the rest of the information in the Network Configuration window. Click Next when you’re done.

firewall-config

12. Set Enable SELinux? to Disabled and click Next on the Firewall Configuration window.

ImportantIt is important to disable Security Enhanced Linux. Setting it to disabled does not make your system any less secure, but it will make your system more predictable. Otherwise, you might find your self spending hours fixing problems caused by it. Here’s one example from the Red Hat Knowledgebase.

additional-lang

13. Choose the default language for your system and add any other languages in the Additional Language Support window. Click Next when you’re done.

time-zone

14. Choose a time zone in the Time Zone Selection window and click Next when you’re done.

set-root-password

15. In the Set Root Password window, specify a strong password at least six characters long and click Next when you’re done.

package-group

16. In the Package Group Selection window, check the following packages to add it to the installation

  • package-x X Window System
  • package-gnome Gnome Desktop Environment
  • package-internet Graphical Internet
  • package-mail Mail Server
  • package-dev Development Tools

Click Details corresponding to X Window System and check system-switch-mail-gnome.

Click Details corresponding to Mail Server and check postfix and squirrelmail

about-to-install

17. Click Next in the About to Install window. It will show you the CDs required, click Continue to proceed. This will start the installation process.

congratulations

18. Congratulations, the installation is complete. Remove the CD and click Reboot to proceed to configuration.

Categories: How To, Linux Tags:

Linux / Unix find command

January 20th, 2009 No comments

 

Source: http://www.computerhope.com/unix/ufind.htm 

 

About find

Finds one or more files assuming that you know their approximate filenames.

Syntax

find path expressions

path
A path name of a starting point in the directory hierarchy.

-atime n
True if the file was accessed n days ago. The access time of directories in path is changed by find itself.

-cpio device
Always true; write the current file on device in cpio format (5120-byte records).

-ctime n
True if the file’s status was changed n days ago.

-depth
Always true; causes descent of the directory hierarchy to be done so that all entries in a directory are acted on before the directory itself. This can be useful when find is used with cpio to transfer files that are contain edin directories without write permission.

-exec command
True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped semicolon. A command argument {} is replaced by the current path name.

-follow
Always true; causes symbolic links to be followed. When following symbolic links, find keeps track of the directories visited so that it can detect infinite loops; for example, such a loop would occur if a symbolic link pointed to an ancestor. This expression should not be used with the -type l expression.

-fstype type
True if the filesystem to which the file belongs is of type type .

-group gname
True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is taken as a group ID.

-inum n
True if the file has inode number n.

-links
True if the file has n links.

-local
True if the file system type is not a remote file system type as defined in the /etc/dfs/fstypes file. nfsis used as the default remote filesystem type if the/etc/dfs/fstypes file is not present.

-ls
Always true; prints current path name together
with its associated statistics. These include
(respectively):

  • inode number
  • size in kilobytes (1024 bytes)
  • protection mode
  • number of hard links
  • user
  • group
  • size in bytes
  • modification time.

If the file is a special file the size field will instead contain the major and minor device numbers.

If the file is a symbolic link the pathname of the linked-to file is printed preceded by `->’. The format is identical to that of ls -gilds ls Note: Formatting is done internally, without executing the ls program.

-mount
Always true; restricts the search to the file system containing the directory specified. Does not list mount points to other file systems.

-mtime n
True if the file’s data was modified n days ago.

-name pattern
True if pattern matches the current file name.  Normal shell file name generation characters (see sh) may be used. A backslash (\) is used as an escape character within the pattern. The pattern should be escaped or quoted when find is invoked from the shell.

-ncpio device
Always true; write the current file on device in cpio -c format (5120 byte records).

-newer file
True if the current file has been modified more recently than the argument file.

-nogroup
True if the file belongs to a group not in the /etc/group file.

-nouser
True if the file belongs to a user not in the /etc/passwd file.

-ok command
Like -exec except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y.

-perm [-]mode
The mode argument is used to represent file mode bits. It will be identical in format to the <symbolicmode> operand described in chmod, and will be interpreted as follows. To start, a template will be assumed with all file mode bits cleared. An op symbol of:

+
will set the appropriate mode bits in the template;

-
will clear the appropriate bits;

=
will set the appropriate mode bits, without regard to the contents of process’ file mode creation mask.

The op symbol of – cannot be the first character of mode; this avoids ambiguity with the optional leading hyphen. Since the initial mode is all bits off, there are not any symbolic modes that need to use – as the first character.

If the hyphen is omitted, the primary will evaluate as true when the file permission bits exactly match the value of the resulting template.

Otherwise, if mode is prefixed by a hyphen, the primary will evaluate as true if at least all the bits in the resulting template are set in the file permission bits.

-perm [-]onum
True if the file permission flags exactly match the octal number onum see chmod). If onum is prefixed by a minus sign (-), only the bits that are set in onum are compared with the file permission flags, and the expression evaluates true if they match.

-print
Always true; causes the current path name to be printed.

-prune
Always yields true. Do not examine any directories or files in the directory structure below the pattern just matched. If -depth is specified, -prune will have no effect.

-size n[c]
True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in
bytes.

-type c
True if the type of the file is c, where c is b, c, d, D, f, l, p, or s for block special file, character special file, directory, door, plain file, symbolic link, fifo (named pipe), or socket, respectively.

-user uname
True if the file belongs to the user uname . If uname is numeric and does not appear as a login name in the /etc/passwd file, it is taken as a user ID.

-xdev
Same as the -mount primary.

When using find to determine files modified within a range of time, one must use the ?time argument before the -print argument; otherwise, find will give all files.

Examples

find -name ‘mypage.htm’

In the above command the system would search for any file named mypage.htm in the current directory and any subdirectory.

find / -name ‘mypage.htm’

In the above example the system would search for any file named mypage.htm on the root and all subdirectories from the root.

find -name ‘file*’

In the above example the system would search for any file beginning with file in the current directory and any subdirectory.

find -name ‘*’ -size +1000k

In the above example the system would search for any file that is larger then 1000k.

 

 

Source : http://www.linux.ie/newusers/beginners-linux-guide/find.php 

 

finder-keepers.

In it’s simplest use the find command searches for files in the current directory and its subdirectories:

$ find .
./tp1301.txt
./up1301.txt
./tp1302.txt
./up1302.txt
./Up1303.txt
./misc/uploads
./misc/uploads/patch12_13.diff

As always, the dot indicates the current directory. Here find has listed all files found in the current directory and its subdirectories.

If we only want to find files with ‘up’ at the start of their name, we use the ‘-name’ argument.

So the following would be used:

$ find . -name up\*
./up1301.txt
./up1302.txt
./misc/uploads

find defaults to being case sensitive. If we want the find utility to locate the file ‘Up1303.txt’ we could either do ‘find -name Up\*‘ or use the iname argument instead of the name argument.

The wildcard character is escaped with a slash so BASH sends a literal asterisk to the find utility as an argument instead of performing filename expansion and passing any number of files in as arguments.

This ‘gotcha’ is important. Be aware of the characters which the shell attaches special meaning to.

Now we know there are files that should have their names in lowercase we can utilise find to get a list of files with names that aren’t:

$ find -iname up\* -not -name up\*

Smooth Operator

find supports boolean algebra with the -and, -or and -not arguments. These are abbreviated as -a, -o and ! (which in bash must be escaped as \!) respectively. The and operator is mentioned here for completeness. Its presence is implied:

$ find . -iname david\*gray\*ogg -type f > david_gray.m3u

These operators are processed in the following order:

Parentheses

Use parentheses to force the order in which the operators are evaluated.

-not

Invert the result of the tested expression.

-and

E.g. ex1 -and ex2; the second expression isn’t checked if the first evaluated to true

-or

E.g. ex1 -or ex2; as with -AND, the second expression isn’t checked if the first evaluated to true

‘,’

This is the list operator where unlike the ‘-AND’ and ‘-OR’ operators both expressions are evaluated. Read the ’2 into 1 does go’ section for more information.

The example in the Smooth Operator boxout creates an m3u playlist listing all ogg files that start ‘David Gray’ (and all case-permutations)

$ find . -iname david\ gray\*ogg -type f > david_gray.m3u

This will find any files called, in one way or the other, "david gray….ogg".

This is semantically equivalent to:

$ find . -iname david\ gray\*ogg -and -type f > david_gray.m3u

It’s equivalent to:

$ find . -iname "david gray*ogg" -and -type f > david_gray.m3u

What if the ogg files themselves mightn’t have the artists name in them and are in some subdirectory of one called ‘David Gray’, how do we find them?

$ find . -ipath \*david\ gray\*ogg -type f > david_gray.m3u

The expression starts with a wildcard because its possible there’s more than one subdirectory named ‘david gray’ that might really be nothing more than symlinks for categorisations.

Here’s another example, we list the contents of the humour directory (one line per file) and do a case-insensitive search for .mp3 files with ‘yoda’ in the name of the file:

$ ls humour -1
Weird Al - Yoda.mp3
welcome_to_the_internet_helpdesk.mp3
werid al - livin' la vida yoda.mp3

$ find -ipath \*humour\*yoda\* -type f
./humour/Weird Al - Yoda.mp3
./humour/werid al - livin' la vida yoda.mp3

2 into 1 does go

As implied in the Smooth Operator boxout, it’s possible to have one invocation of find perform more than one task.

To compile two lists, one containing the names of all .php files and the other the names of all .js files use:

$ find ~ -type f \( -name \*.php -fprint php_files ,
                    -name \*.js -fprint javascript_files \)

Pruning

Suppose you have a playlist file listing all David Gray .ogg files but there are a few albums you don’t want included.

You can prevent those albums from going into the playlist by using the -prune action which works by attempting to match the names of directories against the given expression.

This example excludes the Flesh and Lost Songs albums :

$ find   \( -path  ./mp3/David_Gray/Flesh\* -o -path
"./mp3/David_Gray/Lost Songs" \* \) -prune -o -ipath \*david\ gray\*

The first thing you’ll notice here is the parentheses are escaped out so BASH doesn’t misinterpret them. Notice using -prune takes the form

"don’t look for these, look for these other ones instead". ie:

$ find (-path <don't want this> -o -path <don't want this#2>)
\-prune -o -path <global expression for what I do want>

It might take a bit longer to invoke find to use the -prune action: decide exactly what you want to do first. I find using the -prune action saves me time I can use on other tasks.

Fussy Fozzy!

There’s a host of other expressions and criteria that can be used with find.

Here is a brief rundown on the ones you’ll most likely want to use:

-nouser

file is owned by someone no longer listed in /etc/passwd

-nogroup

the group the file belongs to is no longer listed in /etc/groups

-owner <username>

file is owned by specified user.

We’ll delve into using these, and others, later on.

Print me the way you want me, baby!

Changing the output information

If you want more than just the names of the files displayed, find’s -printf action lets you have just about any type of information displayed. Looking at the man page there is a startling array of options.

These are used the most:

%p

filename, including name(s) of directory the file is in

%m

permissions of file, displayed in octal.

%f

displays the filename, no directory names are included

%g

name of the group the file belongs to.

%h

display name of directory file is in, filename isn’t included.

%u

username of the owner of the file

As an example:

$ find . -name \*.ogg -printf %f\\n

generates a list of the filenames of all .ogg files in and under the current directory.

The ‘double backslash n’ is important; ‘\n’ indicates the start of a new line. The single backslash needs to be escaped by another one so the shell doesn’t take it as one of its own.

Where to output information?

find has a set of actions that tell it to write the information to any file you wish. These are the -fprint, -fprint0 and -fprintf actions.

Thus

$ find . -iname david\ gray\*ogg -type f -fprint david_gray.m3u

is more efficient than

$ find . -iname david\ gray\*ogg -type f > david_gray.m3u

Execute!

File is an excellent tool for generating reports on basic information regarding files, but what if you want more than just reports? You could just pipe the output to some other utility:

$ find ~/oggs/ -iname \*.mp3 | xargs rm

This isn’t all that efficient though.

It is much better to use the -exec action:

$ find ~/oggs/ -iname \*.mp3 -exec rm {} \;

It mightn’t read as well, but it does mean the files are immediately deleted once found.

‘{}’ is a placeholder for the name of the file that has been found and as we want BASH to ignore the semicolon and pass it verbatim to find we have to escape it.

To be cautious, the -ok action can be used instead of -exec. The -ok action means you’ll be asked for confirmation before the command is executed.

There are many ways these can be used in ‘real life’ situations:

If you are locked out from the default Mozilla profile, this will unlock you:

$ find ~/.mozilla -name lock -exec rm {} \;

To compress .log files on an individual basis:

$ find . -name \*.log -exec bzip {} \;

Give user ken ownership of files that aren’t owned by any current user:

$ find . -nouser -exec chown ken {} \;

View all .dat files that are in the current directory with vim. Don’t search any subdirectories.

$ vim -R `find . -name \*.dat -maxdepth 1`

Look for directories called CVS which are at least four levels below the current directory:

$ find -mindepth 4 -type d -name CVS 

Time waits for no-one

You might want to search for recently created files, or grep through the last 3 days worth of log files.

Find comes into its own here: it can limit the scope of the files found according to timestamps.

Now, suppose you want to see what hidden files in your home directory changed in the last 5 days:

$ find ~ -mtime -5 -name \.\*

If you know something has changed much more recently than that, say in the last 14 minutes, and want to know what it was there’s the mmin argument:

$ find ~ -mmin 14 -name \.\*

Be aware that doing a ‘ls’ will affect the access time-stamps of the files shown by that action. If you do an ls to see what’s in a directory and try the above to see what files were accessed in the last 14 minutes all files will be listed by find.

To locate files that have been modified since some arbitrary date use this little trick:

$ touch -d "13 may 2001 17:54:19" date_marker
$ find . -newer date_marker 

To find files created before that date, use the cnewer and negation conditions:

$ find . \! -cnewer date_marker

To find a file which was modified yesterday, but less than 24 hours ago:

$ find . -daystart -atime 1 -maxdepth

The -daystart argument means the day starts at the actual beginning of the day, not 24 hours ago.

This argument has meaning for the -amin, -atime, -cmin, ctime, -mmin and -mtime options.

Finding files of a specific size

A file of character (bytes)

To locate files that have a certain amount of characters present then you can’t go far wrong with

# find files with exactly 1000 characters
$ find . -size 1000c
#find files containing between 600 to 700 characters, inclusive.
$ find . -size +599c -and -size -701c       

‘Characters’ is a misnomer: ‘c’ is find’s shorthand for bytes; thus this will only work for ASCII text not Unicode.

Consulting the man page we see

c = bytes

w = 2 byte words

k = kilobytes

b = 512-byte blocks

Thus we can use find to list files of a certain size:

$ find /usr/bin -size 48k
Empty files

You can find empty files with $ find . -size 0c

Using the -empty argument is more efficient.

To delete empty files in the current directory:

$ find . -empty -maxdepth 1 -exec rm {} \;

Users & Groupies

Users

To locate files belonging to a certain user:

# find /etc -type f \!  -user root -exec ls -l {} \;
-rw------- 1 lp sys 19731 2002-08-23 15:04 /etc/cups/cupsd.conf
-rw------- 1 lp sys    97 2002-07-26 23:38 /etc/cups/printers.conf

A subset of that same information, without having the cost of an exec:

root@ttyp0[etc]# find /etc -type f \!  -user root \
                 -printf "%h/%f %u\\n"
/etc/cups/cupsd.conf lp
/etc/cups/printers.conf lp

If you know the uid and not the username then use the -uid argument:

$ find /usr/local/htdocs/www.linux.ie/ -uid 401

-nouser means there is no user in the /etc/passwd file for the files in question.

Groupies

find can locate files that belong to a specific group – or not, depending on how you use it.

This is especially suited to tracking down files that should belong to the www group but don’t:

$ find /www/ilug/htdocs/  -type f \! -group  www

The -nogroup argument means there is no group in the /etc/group file for the files in question.

This may arise if a group is removed from the /etc/group file sometime after it’s been used.

To search for files by the numerical group ID use the -gid argument:

$ find -gid 100

Permissions

If you’ve ever had one or more shell scripts not work because their execute bits weren’t set and want to sort things out for once and for all, then you should like this little example:

knoppix@ttyp1[bin]$ ls -l ~/bin/
total 8
-rwxr-xr-x    1 knoppix  knoppix	21 2004-01-20 21:42 wl
-rw-r--r--    1 knoppix  knoppix	21 2004-01-20 21:47 ww

knoppix@ttyp1[bin]$ find ~/bin/ -maxdepth 1 -perm 644 -type f \
                    -not -name .\*
/home/knoppix/bin/ww

Find locates the file that isn’t set to execute, as we can see from the output of ls.

Types of files

The ‘-type’ argument obviously specifies what type of file find is to go looking for (remember in Linux absolutely everything is represented as some type of file).

So far I’ve been using ‘-type f’ which means search for normal files.

If we want to locate directories with ‘_of_’ in their name we’d use:

$ find . -type d -name '*_of_*'

The list generated by this won’t include symbolic links to directories.

To get a list including directories and symbolic links:

$ find . \( -type d -or -type l \) -name '*_of_*'

For a complete list of types check the man page.

Regular expressions

Thus far we’ve been using casual wildcards to specify certain groups of files. Find also support regular expressions, so we can use more advanced criteria with regards to locating files. The matching expression must apply to the entire path:

ken@gemmell:/home/library/code$ find . -regex '.*/mp[0-4].*'
./library/sql/mp3_genre_types.sql

The -regex test has a case insensitive counterpart, -iregex.

There is a little gotcha with using regular expressions: You must allow for the full path of the files found, even if find is to search the current directory:

$ cd /usr/share/doc/samba-doc/htmldocs/using_samba
$ find . -regex './ch0[1-2]_0[1-3].*'
./ch01_01.html
./ch01_02.html
./ch02_01.html
./ch02_02.html
./ch02_03.html

Limiting by filesytem

As an experiment, get a MS formatted floppy disk and mount it as root:

$ su -
# mount /floppy
# mount
/dev/sda2 on / type ext2 (rw,errors=remount-ro)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/fd0 on /floppy type msdos (rw,noexec,nosuid,nodev)

Now try

$ find / -fstype msdos -maxdepth 1 

You should see only /floppy listed.

To get the reverse of this, ie a listing of directories that are not on msdos file-systems, use

$ find / -maxdepth 1 \( -fstype msdos \) -prune -or -print

This is a start on limiting the files found by system type.

Summary

I’ve covered the vast majority of ways to use the find utility, but not absolutely everything. If you’ve any questions please don’t hesitate in emailing me

Categories: Linux Commands Tags:

Linux Command Library (Man Pages)

January 20th, 2009 No comments

 

Source: http://linux.about.com/od/commands/l/blcmdl.htm

 

Command Manual Sections (Command Categories):

1. Applications
2. System Calls
3. Library Functions
4. Hardware Devices
(more after the ads)

5. Configuration Files
6. Games
7. Overviews
8. System Administration
9. n Commands

Man pages are manuals for functions and usage of commands. Linux commands may vary in syntax and usage from one distribution of Linux to another. The command library here is provided as general references. Use the man command to see how a command is used on your particular computer.

Categories: Linux Commands Tags:

Linux / Unix Command: chmod

January 20th, 2009 No comments

 

Source: http://linux.about.com/od/commands/l/blcmdl1_chmod.htm

 

NAME

chmod – change file access permissions

SYNOPSIS

chmod [OPTION]… MODE[,MODE]… FILE
chmod [OPTION]… OCTAL-MODE FILE
chmod [OPTION]… –reference=RFILE FILE

DESCRIPTION

This manual page documents the GNU version of chmod. chmod changes the permissions of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new permissions.

The format of a symbolic mode is `[ugoa...][[+-=][rwxXstugo...]…][,...]‘. Multiple symbolic operations can be given, separated by commas.

A combination of the letters `ugoa’ controls which users’ access to the file will be changed: the user who owns it (u), other users in the file’s group (g), other users not in the file’s group (o), or all users (a). If none of these are given, the effect is as if `a’ were given, but bits that are set in the umask are not affected.

The operator `+’ causes the permissions selected to be added to the existing permissions of each file; `-’ causes them to be removed; and `=’ causes them to be the only permissions that the file has.

The letters `rwxXstugo’ select the new permissions for the affected users: read (r), write (w), execute (or access for directories) (x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), sticky (t), the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file’s group (g), and the permissions granted to users that are in neither of the two preceding categories (o).

A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file’s group, with the same values; and the fourth for other users not in the file’s group, with the same values.

chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

STICKY FILES

On older Unix systems, the sticky bit caused executable files to be hoarded in swap space. This feature is not useful on modern VM systems, and the Linux kernel ignores the sticky bit on files. Other kernels may use the sticky bit on files for system-defined purposes. On some systems, only the superuser can set the sticky bit on files.

STICKY DIRECTORIES

When the sticky bit is set on a directory, files in that directory may be unlinked or renamed only by root or their owner. Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on directories, such as /tmp, that are world-writable.

OPTIONS

Change the mode of each FILE to MODE.

-c, –changes
like verbose but report only when a change is made
-f, –silent, –quiet
suppress most error messages
-v, –verbose
output a diagnostic for every file processed
–reference=RFILE
use RFILE’s mode instead of MODE values
-R, –recursive
change files and directories recursively
–help
display this help and exit
–version
output version information and exit

Each MODE is one or more of the letters ugoa, one of the symbols +-= and one or more of the letters rwxXstugo.

SEE ALSO

The full documentation for chmod is maintained as a Texinfo manual. If the info and chmod programs are properly installed at your site, the command

info chmod

should give you access to the complete manual.

Categories: Linux Commands Tags:

Linux / Unix Copy command

January 20th, 2009 No comments

 

Source:  http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=c/cp 

 

cp

cp [options] file1 file2 cp [options] files directory

Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).

Options

-a, –archive

Preserve attributes of original files where possible. The same as -dpr.

-b, –backup

Back up files that would otherwise be overwritten.

-d, –no-dereference

Do not dereference symbolic links; preserve hard-link relationships between source and copy.

-f, –force

Remove existing files in the destination.

-i, –interactive

Prompt before overwriting destination files. On most systems, this flag is turned off by default except for the root user, who is normally prompted before overwriting files.

-l, –link

Make hard links, not copies, of nondirectories.

-p, –preserve

Preserve all information, including owner, group, permissions, and timestamps.

-P, –parents

Preserve intermediate directories in source. The last argument must be the name of an existing directory. For example, the command:

cp –parents jphekman/book/ch1 newdir

copies the file jphekman/book/ch1 to the file newdir/jphekman/book/ch1, creating intermediate directories as necessary.

-r, -R, –recursive

Copy directories recursively.

-S backup-suffix, –suffix=backup-suffix

Set suffix to be appended to backup files. This may also be set with the SIMPLE_BACKUP_SUFFIX environment variable. The default is ~. You need to explicitly include a period if you want one before the suffix (for example, specify .bak, not bak).

-s, –symbolic-link

Make symbolic links instead of copying. Source filenames must be absolute.

–sparse=[always|auto|never]

Handle files that have "holes" (are defined as a certain size but have less data). always creates a sparse file, auto creates one if the input file is sparse, and never creates a non-sparse file without holes.

-u, –update

Do not copy a file to an existing destination with the same or newer modification time.

-v, –verbose

Before copying, print the name of each file.

-V type, –version-control=type

Set the type of backups made. You may also use the VERSION_CONTROL environment variable. The default is existing. Valid arguments are:

t, numbered

Always make numbered backups.

nil, existing

Make numbered backups of files that already have them; otherwise, make simple backups.

never, simple

Always make simple backups.

-x, –one-file-system

Ignore subdirectories on other filesystems.

Example

Copy the contents of the guest directory recursively into the /archives/guest/ directory, and display a message for each file copied:

cd /archives && cp -av /home/guest guest

Categories: Linux Commands Tags:

An A-Z Index of the Bash command line for Linux

January 20th, 2009 No comments

 

Source: http://www.ss64.com/bash

 

a  alias    Create an alias
  apropos  Search Help manual pages (man -k)
  apt-get  Search for and install software packages (Debian)
  aspell   Spell Checker
  awk      Find and Replace text, database sort/validate/index
b
  bash     GNU Bourne-Again SHell
  bc       Arbitrary precision calculator language
  bg       Send to background
  break    Exit from a loop
  builtin  Run a shell builtin
  bzip2    Compress or decompress named file(s)
c
  cal      Display a calendar
  case     Conditionally perform a command
  cat      Display the contents of a file
  cd       Change Directory
  cfdisk   Partition table manipulator for Linux
  chgrp    Change group ownership
  chmod    Change access permissions
  chown    Change file owner and group
  chroot   Run a command with a different root directory
  chkconfig System services (runlevel)
  cksum    Print CRC checksum and byte counts
  clear    Clear terminal screen
  cmp      Compare two files
  comm     Compare two sorted files line by line
  command  Run a command - ignoring shell functions
  continue Resume the next iteration of a loop
  cp       Copy one or more files to another location
  cron     Daemon to execute scheduled commands
  crontab  Schedule a command to run at a later time
  csplit   Split a file into context-determined pieces
  cut      Divide a file into several parts
d
  date     Display or change the date & time
  dc       Desk Calculator
  dd       Convert and copy a file, write disk headers, boot records
  ddrescue Data recovery tool
  declare  Declare variables and give them attributes
  df       Display free disk space
  diff     Display the differences between two files
  diff3    Show differences among three files
  dig      DNS lookup
  dir      Briefly list directory contents
  dircolors Colour setup for `ls'
  dirname  Convert a full pathname to just a path
  dirs     Display list of remembered directories
  dmesg    Print kernel & driver messages
  du       Estimate file space usage
e
  echo     Display message on screen
  egrep    Search file(s) for lines that match an extended expression
  eject    Eject removable media
  enable   Enable and disable builtin shell commands
  env      Environment variables
  ethtool  Ethernet card settings
  eval     Evaluate several commands/arguments
  exec     Execute a command
  exit     Exit the shell
  expect   Automate arbitrary applications accessed over a terminal
  expand   Convert tabs to spaces
  export   Set an environment variable
  expr     Evaluate expressions
f
  false    Do nothing, unsuccessfully
  fdformat Low-level format a floppy disk
  fdisk    Partition table manipulator for Linux
  fg       Send job to foreground
  fgrep    Search file(s) for lines that match a fixed string
  file     Determine file type
  find     Search for files that meet a desired criteria
  fmt      Reformat paragraph text
  fold     Wrap text to fit a specified width.
  for      Expand words, and execute commands
  format   Format disks or tapes
  free     Display memory usage
  fsck     File system consistency check and repair
  ftp      File Transfer Protocol
  function Define Function Macros
  fuser    Identify/kill the process that is accessing a file
g
  gawk     Find and Replace text within file(s)
  getopts  Parse positional parameters
  grep     Search file(s) for lines that match a given pattern
  groups   Print group names a user is in
  gzip     Compress or decompress named file(s)
h
  hash     Remember the full pathname of a name argument
  head     Output the first part of file(s)
  history  Command History
  hostname Print or set system name
i
  id       Print user and group id's
  if       Conditionally perform a command
  ifconfig Configure a network interface
  ifdown   Stop a network interface
  ifup     Start a network interface up
  import   Capture an X server screen and save the image to file
  install  Copy files and set attributes
j
  join     Join lines on a common field
k
  kill     Stop a process from running
  killall  Kill processes by name
l
  less     Display output one screen at a time
  let      Perform arithmetic on shell variables
  ln       Make links between files
  local    Create variables
  locate   Find files
  logname  Print current login name
  logout   Exit a login shell
  look     Display lines beginning with a given string
  lpc      Line printer control program
  lpr      Off line print
  lprint   Print a file
  lprintd  Abort a print job
  lprintq  List the print queue
  lprm     Remove jobs from the print queue
  ls       List information about file(s)
  lsof     List open files
m
  make     Recompile a group of programs
  man      Help manual
  mkdir    Create new folder(s)
  mkfifo   Make FIFOs (named pipes)
  mkisofs  Create an hybrid ISO9660/JOLIET/HFS filesystem
  mknod    Make block or character special files
  more     Display output one screen at a time
  mount    Mount a file system
  mtools   Manipulate MS-DOS files
  mv       Move or rename files or directories
  mmv      Mass Move and rename (files)
n
  netstat  Networking information
  nice     Set the priority of a command or job
  nl       Number lines and write files
  nohup    Run a command immune to hangups
  nslookup Query Internet name servers interactively
o
  open     Open a file in its default application
  op       Operator access
p
  passwd   Modify a user password
  paste    Merge lines of files
  pathchk  Check file name portability
  ping     Test a network connection
  popd     Restore the previous value of the current directory
  pr       Prepare files for printing
  printcap Printer capability database
  printenv Print environment variables
  printf   Format and print data
  ps       Process status
  pushd    Save and then change the current directory
  pwd      Print Working Directory
q
  quota    Display disk usage and limits
  quotacheck Scan a file system for disk usage
  quotactl Set disk quotas
r
  ram      ram disk device
  rcp      Copy files between two machines
  read     read a line from standard input
  readonly Mark variables/functions as readonly
  reboot   Reboot the system
  renice   Alter priority of running processes
  remsync  Synchronize remote files via email
  return   Exit a shell function
  rev      Reverse lines of a file
  rm       Remove files
  rmdir    Remove folder(s)
  rsync    Remote file copy (Synchronize file trees)
s
  screen   Multiplex terminal, run remote shells via ssh
  scp      Secure copy (remote file copy)
  sdiff    Merge two files interactively
  sed      Stream Editor
  select   Accept keyboard input
  seq      Print numeric sequences
  set      Manipulate shell variables and functions
  sftp     Secure File Transfer Program
  shift    Shift positional parameters
  shopt    Shell Options
  shutdown Shutdown or restart linux
  sleep    Delay for a specified time
  slocate  Find files
  sort     Sort text files
  source   Run commands from a file `.'
  split    Split a file into fixed-size pieces
  ssh      Secure Shell client (remote login program)
  strace   Trace system calls and signals
  su       Substitute user identity
  sudo     Execute a command as another user
  sum      Print a checksum for a file
  symlink  Make a new name for a file
  sync     Synchronize data on disk with memory
t
  tail     Output the last part of files
  tar      Tape ARchiver
  tee      Redirect output to multiple files
  test     Evaluate a conditional expression
  time     Measure Program running time
  times    User and system times
  touch    Change file timestamps
  top      List processes running on the system
  traceroute Trace Route to Host
  trap     Run a command when a signal is set(bourne)
  tr       Translate, squeeze, and/or delete characters
  true     Do nothing, successfully
  tsort    Topological sort
  tty      Print filename of terminal on stdin
  type     Describe a command
u
  ulimit   Limit user resources
  umask    Users file creation mask
  umount   Unmount a device
  unalias  Remove an alias
  uname    Print system information
  unexpand Convert spaces to tabs
  uniq     Uniquify files
  units    Convert units from one scale to another
  unset    Remove variable or function names
  unshar   Unpack shell archive scripts
  until    Execute commands (until error)
  useradd  Create new user account
  usermod  Modify user account
  users    List users currently logged in
  uuencode Encode a binary file
  uudecode Decode a file created by uuencode
v
  v        Verbosely list directory contents (`ls -l -b')
  vdir     Verbosely list directory contents (`ls -l -b')
  vi       Text Editor
  vmstat   Report virtual memory statistics
w
  watch    Execute/display a program periodically
  wc       Print byte, word, and line counts
  whereis  Report all known instances of a command
  which    Locate a program file in the user's path.
  while    Execute commands
  who      Print all usernames currently logged in
  whoami   Print the current user id and name (`id -un')
  Wget     Retrieve web pages or files via HTTP, HTTPS or FTP
  write    Send a message to another user
x
  xargs    Execute utility, passing constructed argument list(s)
  yes      Print a string until interrupted
  .        Run a command script in the current shell
  ###      Comment / Remark
Categories: Linux Commands Tags:

Linux / Unix mkdir command

January 20th, 2009 No comments

 

Source : http://www.computerhope.com/unix/umkdir.htm

 

About mkdir

Short for make directory this command is used to create a new directory.

Syntax

mkdir dirname

dirname
The name of the directory that you wish to create.

Examples

mkdir mydir – This would create a new directory called mydir.

 

 

Source : http://www.ss64.com/bash/mkdir.html 

 

mkdir

Create new folder(s), if they do not already exist.

SYNTAX
      mkdir [Options] folder...

      mkdir "Name with spaces"

OPTIONS
  -m, --mode=MODE   set permission mode (as in chmod), not rwxrwxrwx - umask
  -p, --parents     no error if existing, make parent directories as needed
      --verbose     print a message for each created directory

 

mkdir creates the standard entries . (dot) for the current folder

and .. (dot dot) for its parent

Any folder name that includes spaces may appear in some applications

as "Name%20with%20spaces"

Categories: Linux Commands Tags: