Forgot your password?

Using Linux Bash - Help, Man, and Working With Folders

By Edited Nov 13, 2013 0 0

Getting Help

man mkdir
Typing in Help in the Terminal should show you from the start how interesting and different Bash is. There's a lot of intimidating-looking commands in there. If you're curious about any given command, you can type in help command to see what the command does and how to use it. Man command will tell you everything you ever wanted to know about that particular command.

man mkdir

The man mkdir command produces 63 lines of information that tells you how to use Mkdir to make directories, this command's options, who wrote the manual, and where to send bug reports if Mkdir doesn't work as expected. Scroll down using the down arrow on your keyboard to see more.



Using Mkdir


You use Mkdir to make directories, or “folders” in layman parlance. You can use it to create new folders within the folder that Terminal is pointed at right now by typing mkdir ./yourdirectory, with yourdirectory being the name of your new directory. If you are creating directories within directories that don't exist yet or just want to save the time it would take to move between directories, you can save time by typing mkdir -p /home/Documents/blog/Infobarrel. By using the -p option, you tell Bash to create the directory called “blog” if it doesn't exist in Documents yet, and then make the directory called “Infobarrel” within “blog”.

Changing Directories


The cd command moves between one directory and another in Terminal. Keep in mind that Terminal is case-sensitive when it comes to working with the Linux file system. To move to Downloads from the home directory, cd Downloads will work but cd downloads will give you an error. Moving up one level in the directory tree (which looks much like a family tree if you map it out) is as simple as using cd .. to move up to a directory's parent. Type in cd ~ for a quick way to return to the home directory. If you need to see exactly where you are now in the file system, pwd will give you the exact path for the working directory.

Copying Files

To copy files, go to the directory that has the file to be copied and use cp copiedfile destinationfolder. To avoid overwriting a previous file with the same name in the destination, using the -n or -no-clobber option is good (and you can't tell me that the people who created Bash don't have a sense of humor). The -i option will prompt the user before overwriting a file.

Deleting Files And Directories

If you need to remove a directory, double-check that the one you want to delete doesn't contain anything you need later because deleting directories will also delete the files the contain. Then, use rm -r yourdirectory or rmdir yourdirectory to remove the directory. rm yourfile works for deleting individual files.

Easy So Far?

As you can see, Bash and Terminal are useful tools for moving files, creating new folders, deleting items in your file system that are no longer needed, and doing some general management of your files. Keep working with it but be careful, because it is easy to get lost in the directory tree. I'd call it a "forest", but that's a whole different arena to computer professionals.



Add a new comment - No HTML
You must be logged in and verified to post a comment. Please log in or sign up to comment.

Explore InfoBarrel

Auto Business & Money Entertainment Environment Health History Home & Garden InfoBarrel University Lifestyle Sports Technology Travel & Places
© Copyright 2008 - 2016 by Hinzie Media Inc. Terms of Service Privacy Policy XML Sitemap

Follow IB Technology