music
OSdata.com: programming text book 

OSdata.com

mkdir

summary

    This subchapter looks at mkdir, a UNIX (and Linux) command.

    mkdir is used to make a directory.

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

mkdir

    This subchapter looks at mkdir, a UNIX (and Linux) command.

    mkdir is used to make a directory.

make a directory

    Use the mkdir command to make a new directory (folder).

    $ mkdir testdir
    admins-power-mac-g5:~ admin$

multiple directories

    You can name multiple directories with the mkdir command. Simply list each of the new diretcories after the mkdir with a space character between each directory name.

    $ mkdir directory1 directory2 directory3
    admins-power-mac-g5:~ admin$

create with permissions

    Use the -m option to create a directory with specific permissions. The permission chocies are the same as with the chmod command. Replace mode (a=rwx in the following example) with an appropriate mode argument. In the following example, themode is a=rwx, which would give all users read, write, and execute permissions.

    $ mkdir -m mode directory1 directory2 directory3
    admins-power-mac-g5:~ admin$

    This option is often used in shell scripts to lock down temporary directories.

use a path

    You can give an entire path name to a specific directory, using either a relative or absolute path name to create the directory anywhere int he file system.

    $ mkdir directory1/directory2/directory3
    admins-power-mac-g5:~ admin$

    You can use the -p option to create directories along the path. You can therefore, create a series of parent and child directories all at once.

    If you use the -p option and the directory already exists, the mkdir command will continue on through your path and create new directories as needed down to the last one you list.

    $ mkdir -p directory1/directory2/directory3
    admins-power-mac-g5:~ admin$

    Intermediate directories are created with the permission bits of rwxrwxrwx (0777) as modified by the current umask, plus the write and search permission for the owner.

view directories made

    You can use the -v to get a list of the directories created. This is most often used with the -p option, but you can use it by itself.

    $ mkdir -v directory1/directory2/directory3
    admins-power-mac-g5:~ admin$

    $ mkdir -pv directory1/directory2/directory3
    admins-power-mac-g5:~ admin$

    The -v option is considered nonstandard and should not be used in shell scripts.

spaces in names

    To create a directory with space in the directory name, you need to use quoting for the entire name so that the shell treats it as a single name rather than a series of individual directory names separeted by spaces.

    $ mkdir " directory name"
    admins-power-mac-g5:~ admin$

    While it is common to use spaces in file and directory names in graphic user interfaces (such as Macintosh, OS/2, and Windows, as well as Gnome or KDE), this may cause failure with older scripts or programs. Some programs may convert the spaces in a directory name into %20, such as converting " Name with spaces" into " Name%20with%20spaces" . This might cause confusion or failure.

long options

    The long options are:

-m   --mode=MODE
-p   --parents
-v   -verbose
-Z   --context=CONTEXT
    --help
    --version

various operating systems

    The mkdir command appears in the Linix, Mac OS X, OS/2, PC-DOS (also called MS-DOS), UNIX, and Windows operating systems. It also appears in the PHP programming language. In OS/2, PC-DOS, and Windows, the command can be abbreviated md.

history

    The mkdir command appeared in Version 1 of AT&T UNIX. In early versions of UNIX, the mkdir command had to be setuid root because the kernel did not yet have a mkdir syscall. The mkdir command made a directory with the mknod syscall, followed by linking in the . and .. directories.

    The mkdir syscall originated in 4.2 BSD and was added to System V in Release 3.0.

other

    On November 8, 2010, Ramesh Natarajan named this the number 35 most frequently used UNIX/Linux command at this web page 50 Most Frequently Used UNIX / Linux Commands (With Examples).


free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).

    Work on this project is very slow because I am homeless. I am available for work if someone can provide an indoor place to work in Costa Mesa, California, electricity, internet connections, a flat raised working surface (such as a table or desk), a sitting device (such as a chair or stool), and a fully functional reasonably modern used computer. I’m already homeless, so you don’t need to pay me (and I understand how much business people hate the minimum wage law). Just give me a chance to work.


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

    At the time I am homeless. This greatly interferes with my ability to create this project, which can help nearly 20 million U.S. college students and more than 150 million students world-wide. I am looking for 30 rich people or corporations willing to donate $10 a month to my church so that the church can provide a place indoors for me to continue work. If you want to donate, please see help project. Thanks much.

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


I do the news as an unpaid volunteer for KOCI 101.5 FM, Newport Beach/Costa Mesa (also available on the web)


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2012 Milo

    Created: February 14, 2012

    Last Updated: September 10, 2012


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

previous page next page
previous page next page