make multiple directories

mkdir {1..100}
make multiple directories within bash. www.fir3net.com
Sample Output
[root@Fileserver test]# mkdir {1..100}
[root@Fileserver test]# ls
1        13  19  24  3   35  40  46  51  57  62  68  73  79  84  9   95
10       14  2   25  30  36  41  47  52  58  63  69  74  8   85  90  96
100      15  20  26  31  37  42  48  53  59  64  7   75  80  86  91  97
11       16  21  27  32  38  43  49  54  6   65  70  76  81  87  92  98
17  22  28  33  39  44  5   55  60  66  71  77  82  88  93  99
12       18  23  29  34  4   45  50  56  61  67  72  78  83  89  94

-2
By: felix001
2011-02-21 21:09:37

These Might Interest You

  • This sorts files in multiple directories by their modification date. Note that sorting is done at the end using "sort", instead of using the "-ltr" options to "ls". This ensures correct results when sorting a large number of files, in which case "find" will call "ls" multiple times.


    2
    find . -type f -exec ls -l --full-time {} + | sort -k 6,7
    quadcore · 2012-08-03 22:22:51 0
  • Normally, if you just want to see directories you'd use brianmuckian's command 'ls -d *\', but I ran into problems trying to use that command in my script because there are often multiple directories per line. If you need to script something with directories and want to guarantee that there is only one entry per line, this is the fastest way i know Show Sample Output


    -10
    ls -l | grep ^d | sed 's:.*\ ::g'
    LinuxMan · 2011-08-06 23:52:46 4
  • Leave it to a proprietary software vendor to turn a cheap and easy parlor trick into a selling point. "Hey guys, why don't we turn our _collection of multiple files_ into a *collection of multiple files*!!" Extract the ^above with this: cat pics.tar.gz.??? | tar xzv ^extract on any Unix - no need to install junkware! (If you must make proprietary software, at least make it do something *new*) if [ -e windows ]; then use 7-Zip


    11
    tar czv Pictures | split -d -a 3 -b 16M - pics.tar.gz.
    asmoore82 · 2009-06-09 19:48:01 3
  • I wrote this a long time ago, wondering why this wasn't floating around somewhere out there (at least not where I could find).. this seems much more simple than multiple aliases and can cd out of directories easier. Show Sample Output


    8
    up() { local x='';for i in $(seq ${1:-1});do x="$x../"; done;cd $x; }
    evil · 2012-05-16 04:21:41 1

What Others Think

should me mkdir {1..100} and try mkdir {001..100} better when read
pepin · 382 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: