Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, July 16, 2010

Free Online Linux Tutorials for Beginners

Apptya




Welcome to our FREE online Linux tutorials for beginners! You will find many Linux help tutorials here and the beginner Linux tutorial will constantly be updated. There is always new Linux software being developed and added into this awesome opensource Unix-based operating system that will need tutorials and guides written for beginners.


Even though beginner Linux tutorials will be geared towards Linux beginners, we will also have plenty of help here as well for those advanced Linux users. I myself have been using Linux since around 1996 maybe? I do consider myself a Linux guru or advanced user, but even I need to look up Linux tutorials, Linux how-tos, or maybe even Linux hardware compatibility. There is constantly new hardware coming out everyday and most computer hardware manufacturers don’t make drivers for Linux. What do you do? Jump on your favorite search engine and look for what modules to load or maybe what configuration file needs edited. Which with some of the new Linux software in today’s world, most hardware is auto-detected.

Hope you enjoy your stay at beginner Linux tutorials and that you find the Linux tutorials very helpful even if you are an advanced Linux user. Which by the way if you are an advanced Linux user and want to help contribute some tutorials for Linux beginners please let me know! I would appreciate it very much to get some more writers to help get more users away from the evil Microsoft products by making it easier for the Linux beginners to understand and operate the Linux operating system.

Linux chown Command Change Owner

The Linux chown command is used to change the owner and group of a file or directory. If you have a directory and you are not the owner and would like to be the owner of that directory, you can use the Linux chown command to change the owner to your username.

Some of you may get a lot of permission denied errors while trying to open files or folders, this may be caused by improper ownership or owner permissions. If it is a ownership problem,
chown will fix your problem. If it is a permission problem, then you will want to look into chmod.

The usage of chown is chown [OPTIONS] [OWNER]:[GROUP] [FILE]. There are many options for chown, but I only use 2 of them on a regular basis. I use chown -R | --recursive and also chown --from=CURRENT_OWNER:CURRENT_GROUP. Basically chown -R is used on directories and all files in that directory. chown --from=CURRENT_OWNER:CURRENT_GROUP is used if you want to only change files that are currently owned by CURRENT_OWNER:CURRENT_GROUP.

For some examples of the Linux chown command. Say I have a desktop computer with Linux on it, and my username on the desktop computer is BrandonStimmel, and I buy a new laptop and install Linux on it, and this time I made my username Brandon. I also want to get rid of my desktop because it is slow and uses a lot of electricity. So I want to copy all of my files and folders from the desktop’s /home/BrandonStimmel to the laptop’s /home/Brandon. I simply use rsync, cp, or scp to copy the files and folders from the desktop computer to the laptop computer. Trouble is, I can only read files, I can’t write to them. I keep getting permission denied errors, and you don’t have permission to write to the file $FILE. So I login to the laptop as my user, then su to root, since root has permissions to read and write to the files/folders. Then I run chown -R --from=BrandonStimmel:users Brandon:users /home/Brandon/* Some may ask why I used chown --from= in this example. Well I have a ton of files in my home folder from my desktop and I may have some files that were meant to be owned by root, or some other user as backups. I didn’t want to change all of them to my new username unless I owned them before.

If you use the same example but don’t care who previously owned the files/folders, you can run chown -R Brandon:users /home/Brandon/* and you will change all files/folders in /home/Brandon to be owned by the username Brandon and the group users.

I hope this Linux tutorial on the Linux chown command has helped you fix your permission issues. If you have any questions please feel free to contact Beginner Linux Tutorial by leaving a comment or sending an email. Have a great day and remember to read more Linux tutorials! Knowledge is power, especially with Linux!

Linux more and less Commands

The Linux commands more and less are similar to cat, but with more and less you can scroll the file instead of showing the enter file at once. So if you have larger files you want to view that are longer than your screen or terminal then you can use more or less commands instead of cat.


I would suggest using less more often than more as the Linux less command can load files to the screen faster. If you do more somefile.txt the entire file must be read before it will start displaying on your screen. If you use less somefile.txt the contents of somefile.txt will be displayed as they are read from the file, so you don’t have to wait until the entire contents are read before you can see it!

Another reason I would suggest using the Linux command less more than the Linux command more is because with less command you can scroll up in the file as well as down, where with the Linux command more you can only scroll down the file. If you pass something with more you have to quit, run the more command again, and hope you don’t pass what you were looking for again.

The syntax for more is like most Linux commands: more [OPTIONS] [filename]. The sytax for less is the same: less [OPTIONS] [FILENAME].

The only options I use normally with less is less -N [FILENAME] which will print line numbers before each line. The only options I use on more is more +[number] [FILENAME] which will start you on line [number].

Now for some examples of more.

If I wanted to view file phone-numbers.txt to write them down on paper, or enter into my cellphone, I could run more phone-numbers.txt and hit enter to scroll down after I have already entered the information on my cellphone or wrote them down on paper.

If I was working on a php/mysql website and I click on Login which takes me to login.php and I get something like: PHP parse error : syntax error, unexpected T-STRING on line 130 in file /home/user/www/login.php I can then run more +130 /home/user/www/login.php which will start me on line 130 where the error is so I can look for what is wrong and then fix it.

Now for some examples of less.

If I was working on a php/mysql website and I was writing a foreach() loop on my php script and needed a little help from someone that has a copy of my script, I could do less -N some-script.php and tell him or her what lines I was having problems with.

Well that’s it for the Linux more and less commands. As always I hope this Linux tutorial on the Linux less and more commands has helped you understand more and less a bit more! Thank you for reading my Linux tutorials on Beginner Linux Tutorial, I hope you have a great day! Any questions of problems with more or less can be asked below in the comment section.

Linux grep Command

The Linux grep command is used to extract lines of data from files or extract data from other Linux commands by using a pipe. When using the Linux grep command, there are many ways you can extract or print lines. You can use standard text to grep or you can use regex patterns. When using regex patterns you can use basic regular expression (BRE),
extended regular expression (ERE), or even a Perl regular expression!
There are many different grep options you can use in the grepsyntax. I myself only use a few options with grep on a regular basis. The basic grep syntax is grep [options] [pattern] [file|files].
grep quick reference guide:
You can use grep -R, grep -r, grep --recursive, which will allow you to have grep parse files recursivley into other directories.
If you are working with code, or just want the output lines to be numbered you can use grep -n or grep --line-number.
Another option I use on a daily basis with grep is grep -i or grep --ignore-case, which will ignore case on both the input file, and the pattern. by default grep is case sensitive, so you have to use this option if you do not want it case sensitive.
If you are wanting to extract multiple patterns from your file, you can use grep -e which can be used multiple times to extract multiple patterns from your file. So if you are wanting to grep two different strings from one file in Linux, you could do grep -e firstpattern -e secondpattern /home/$USER/file.txt.
Here are some grep examples of using the Linux grep command:
If I had a plain text file called phone-book.txt, that had phone numbers listed in this order: First Name Last Name - Street Address - Phone Number
Now I want to get Brandon Stimmel’s phone number. I could rungrep Brandon\ Stimmel phone-book.txt and grep would print Brandon Stimmel - 100101 Digital Ave. Tech, Ohio 44333 (330) 222-7222. Notice I used Brandon\ Stimmel, I did this because you can not use a space on the command line, or it will be parsed as the next section of the command, which grep Brandon Stimmel phone-book.txtwithout the \ would try to extract Brandon from the file Stimmel, which doesn’t exist. So remember to escape your spaces with a \ if you are using them in your pattern/search string.
For another example, if I want to bring up who owns the phone number (330) 222-7222 as it showed up on my caller ID, but I forgot who’s phone number it was, I can do grep \(330\)\ 222-7222 phone-book.txt which would again display: Brandon Stimmel - 100101 Digital Ave. Tech, Ohio 44333 (330) 222-7222.
You can also grep for just the last name, say if you are having a family reunion and you want to bring up all of the people with the last name of Stimmel. grep Stimmel phone-book.txt this will bring up every person in phone-book.txt that has the last name of Stimmel.
You can also pipe data to grep or pipe data from grep to use it in a bash script. Say if you are wanting to do the above example that you found a phone number and forgot who’s it was, but you don’t want to show the entire line with name, address, and number, you just want the name and only the name. grep \(330\)\ 222-7222 phone-book.txt|awk '{print $1" "$2}' which will outputBrandon Stimmel. The grep part of this code will output the full string, then we pass that data onto awk which we used it to print only the first and second fields

Linux cat Command

Linux cat Command
In this Linux tutorial you will learn how to use the Linux cat command. The Linux cat command is the Unix command to list a file’s contents onto your screen, or pass via pipeline to use with other Linux commands. The cat command comes from the word concatenate.

The usage of the Linux cat command is cat
[options] [file].

There are quite a few options you can use with the Linux cat command, but I rarely use any of them on a regular basis. The only option I use with the cat command on a regular basis is cat -n or cat --number.

For an example of using the cat command, we’ll say I have a file named Linux-Friends.txt and in this text file I have some friend’s names, phone numbers, and e-mail addresses that run Linux. So now I want to get someone’s phone number from this list. I can run cat Linux-Friends.txt in a Linux terminal and I will get the contents of this file listed on my screen.

Now if I wanted to see how many friends I have listed in this file, I can have cat number the lines for me by using the cat -n option. So if I run cat -n Linux-Friends.txt the cat command will then output each of the Linux friend’s that I have listed and place a number in front of each one so I can see how many friends I have. Using cat -n [file] is also useful when doing some programming or coding, so you can see what line number you need to edit.

You can also pipe off of the Linux cat command to use it with other Linux commands. So for this example of the Linux cat command I want to only grab a certain person’s name from the list to display their contact information. So I can run cat Linux-Friends.txt|grep Brandon and now I will only get Brandon’s contact information.

Another example of using the Linux cat command with other Linux commands via pipe is if I only want Brandon’s email address to display and not his phone number. The Linux-Friends.txt file is in this format: last name, first name – phone number – email address so I can use the Linux cat command with grep and also awk to display only what I want. So I can run cat Linux-Friends.txt|grep Brandon|awk '{print $4" "$5}' and now I have Brandon’s phone number.

For an explaination of the command above I will show each output as each command is ran.
cat Linux-Friends.txt
–friend 1,2,3–
Stimmel, Brandon – (330) 222-7222 – news@beginnerlinuxtutorial.com
–friend 5,6,7–
Now we add |grep Brandon
Stimmel, Brandon – (330) 222-7222 – news@beginnerlinuxtutorial.com
and you see the other friends are now gone. Now we can add |awk '{print $4" "$5}' which will display the 4th and 5th column, and the – in that file counts as a column as well. The 4th column is (330) and the 5th column is 222-7222. So my output now would be: (330) 222-7222

How to Delete in Linux Terminal rm Command

Many Linux users get confused when they are in a Linux terminal and trying to delete files of folders. So in this Linux tutorial, I will cover how to delete files in Linux terminal! The Linux delete command is another basic command that is used everyday while in a Linux terminal. There are only 2 options that I use on a regular basis with the Linux rm
command.

The usage of the Linux rm command is rm [options] [file|dir]. The 2 options I use most is rm -r [dir] and rm -f [file]. Now to explain these options for the Linux delete command and also give you some examples on how to remove a file with Linux.

The rm -f [file] option is if you are wanting to force a file to be removed. This will not ask you “are you sure you want to remove [file]“. It will just delete the file regardless. So use this option for the Linux rm command only if you know you want all of the file(s) deleted.

Now the rm -r [dir] option is if you are wanting to delete a directory in Linux. The rm -r option is to specify to remove recursively, meaning a directory and it’s contents.

You can use these 2 options for the Linux delete command together as well. You could use the command rm -rf [dir] to delete a directory forcefully and recursively. DO NOT be fooled into running rm -rf /, rm -rf /* as this will remove all of your files and folders. Some people may come off as they are trying to help you with Linux and be a dick and tell you to run rm -rf /* which you can then say bye bye to your files and folders.

You can also use rm in a script type command after a pipe | so you can delete filenames of the output. You can also use rm to remove files that are produced from another command or script. Here is an example of how to remove a file found after grep in Linux. Say if you have a folder /home/max/images/family and in this directory you have 20 images that have the word copy in the title because you accidentally highlighted these 20 files, went to drag them into another folder in a GUI, and let go too early and created copies. So now you want to remove these copies, you would first cd to that directory cd /home/max/images/family now you can run rm -f `ls | grep copy` which will remove all the files that ls | grep copy matches. This same process could be done easier by running rm -f *copy* instead, but these are just examples.

I hope reading this Linux tutorial on the Linux rm command has taught you more than you already know and that you can continue reading through this Beginner Linux Tutorial website and learn even more about the Linux operating system! Have a great day and remember DO NOT run rm -rf /* or any variation of it. I will write a section on Beginner Linux Tutorial explaining more of the commands that can harm your system to watch out for when people are trying to help you with Linux so that you will not be a victim of this. If you are unsure if a command will harm your system, you can always do a quick reference check by searching the net for that command, or even looking at the man pages for that command to see what it is that command/options will do. You can read your manpages by typing man [command] like man rm will bring up the manual for the Linux rm command.

How to Move Files in Linux mv Command

If you are wanting to know how to move files in Linux, you will need to use the Linux mv command. There are a few different options you can use with the Linux mv command, but I normally don’t use them. I do use the Linux mv command along with other commands to accomplish some tasks though. If you wanted to get information on the other
options for the Linux mv command, remember you can always run man mv in a bash shell prompt.
The usage of the Linux mv command to move files around on your file system is much like the Linux cp command, but the source will no longer exist. To use the mv command in Linux shell, just run mv [source] [destination].
So for example I am making a new account on another Linux computer. I want to move my home directory to the new Linux computer. So first I setup nfs and mount my new Linux computer’s/home directory on my old Linux computer. Now I will run mv /home/max /mnt/home/ so all of my files move to my new Linux computer. This is just an example as I would most likely use rsyncLinux command to do this. Which I will go over in another Linux tutorial.
I have also seen a few Linux beginners having trouble moving files in Linux that have special characters in them. So to move files with special characters in Linux you will simple escape the characters that hold special meanings, like a space, (, or ). So for example I have a file named DSC06540 (New LCD TV).JPG this is an ugly filename but to move this file from my compact flash drive on my camera to my/home/max/images/electronics directory, I would simple escape all the special characters with a \ like this mv /media/CF/DSC06540\ \(New\ LCD\ TV\).JPG /home/max/images/electronics/
Another command I use quite often with the mv shell command isfind. I can have find search for files on my computer and move the files to a new location. To do this there are 2 methods you can use, one method of using Linux find to move files is a small script, for example if I want to move all my php files to /home/max/htdocs/I would run this: for i in `find *php`; do mv $i /home/max/htdocs; done.
Method 2 that uses Linux find command to move files in Linux is using the -exec option of find to execute mv. This command was brought to my attention a few days ago by another Linux user, and it is much faster than my method. Using the same example to move my php files, but using this method, you will run: find *php -exec mv {} /home/max/htdocs \; which is a lot less to type!
You can also change your find options any way you prefer to search your hard drive for the files you are looking for. Which I will go over in another Linux tutorial.
As you can see it isn’t hard at all to move files and folders in Linux shell prompt at all. As always I hope this Linux tutorial for beginners has helped you learn more about the Linux mv command. I hope you come back and find more help on Beginner Linux Tutorial.

cp Linux Copy Command

The Linux copy command is cp! Pretty simple right? There are many ways to use the Linux cp command. There are also many options for the cp command, but I usually only use 2 of them daily. The other options for Unix cp command I hardly use because there are other commands or programs in Linux that do a much better job for accomplishing the same tasks.
So for the other options for the Linux copy command, I will not cover them in this tutorial. If there is some specific cp command usage or syntax you want to know, please let me know and I will add it to this Linux tutorial.

The 2 options for the Linux cp command that I will cover is how to copy file recursively and also how to copy files in Linux only if the source file is newer than the destination file.

First the syntax for using the Linux cp command is cp [options] [source] [destination], where [source] or [destination] may be a file or a directory.

The main option for the Linux cp command that I use is coping a directory recursively. To do this you would use cp -R [source] [destination], cp -r [source] [destination], or cp --recursive [source] [destination]. I usually am lazy and just use the shortest easiest keystroke, cp -r [source] [destination].

Coping a directory recursively means copying the entire folder, including it’s contents. For example if I was wanting to copy the directory /home/max/images/family/ and all of the directories and files inside of it to /media/backup_drive/, I would run cp -r /home/max/images/family /media/backup_drive/

Now if I was not wanting to copy the entire directory and just wanted only the *.jpg files, I would not need the -r option. I would simply run cp /home/max/images/family/*.jpg /media/backup_drive/family/jpeg_files/ which * is a wildcard, so anything.jpg will be copied. Yes, that is a bad example as that is a very ugly directory structure, but again it is about 4:30am and I should really be sleeping!

There are much better ways to backup your data in Linux than using the cp command, that is the only example I could come up with at the moment. In another Linux tutorial I will cover how to backup your files in Linux using a lot more efficient methods.

The next option that I use from time to time on the Unix cp command is cp -u [source] [destination] or cp --update [source] [destination] which will only copy files if the source files are newer than the destination files, or if the destination files do not exist.

For an example of the Linux cp -u command I am wanting to copy files from my website and back them up, but I only want to copy the files that are newer, to save CPU usage and drive writes, no use in overwriting files that are the same or older right? So I will run cp -u /home/max/htdocs/* /media/backup_drive/htdocs/

If you are wanting to copy hidden files and folders in Linux using the cp command, the first thing people will think of is cp -r .* /media/backup_drive/max/hidden_config_files/ but this will actually match ./ and ../ as well, which will copy all files in the current working directory, and also copy all the files from the parent directory. So to copy only hidden files in Linux, you would want to run cp -r .[a-z,A-Z,0-9]* /media/backup_drive/max/hidden_config_files/ this way it will only match files that start with a . and the next character is a-z, A-Z, or 0-9 and everything after that being a wildcard.

Change Directory using cd Linux Command

In this Linux tutorial for beginners, you will learn how to change directories in Linux using the cd command. The Linux cd command is very easy to use. There are a couple options you can use with the cd command, but I won’t cover them as I hardly ever use them. I will show you how to use some common variables with the Linux cd command though.


When using the Linux cd command to change directory, the syntax of the Unix cd command is cd [directory]. Pretty easy to remember right? So if you are wanting to change your current working directory to your home directory, you can run cd /home/max as max is my username. With the cd command if you do not specify any directory it will automatically change directory to your home, so just running cd in the Linux shell will take you to your home directory as well. Another way to get to your home directory in Linux is using the home variable $HOME. So if you type cd $HOME you will be taken to your user’s home directory as well.

You can also use the $HOME variable as part of a path. Say if you wanted to change directory to /home/max/images/family you could run cd $HOME/images/family which will take you to /home/max/images/family but of course your $HOME not mine!

Some other common uses of the Linux cd command is to change directory to the parent directory. To do this you could use cd ../ which will change directory to the parent directory of the active directory you are already in. You can also use ../ as part of your path, so say my current working directory is /home/max/images/family and I want to change directory to /home/max/images/friends you have 2 options. You can run the cd command with the full path: cd /home/max/images/friends or your other option is to use the ../ parent directory as part of your path like this: cd ../friends/ since I was already in /home/max/images/family the parent directory is /home/max/images/

One more common thing I see some people asking is how to change to a directory with a space in the shell. When you are in the command line interface a space is a special character so you will have to escape it using a backslash \ I usually try not to make any filenames or directory names with any special characters in them, but if you do have a directory named say Linux Stuff you would use cd Linux\ Stuff to change directories.

You can also use the cd shell command to change directory as part of a script. For example if I was wanting to make a script that would change directory to /usr/local/games/quake3 and then run ./quake3 since the quake3 game needs your shell to be in /usr/local/games/quake3 as the working directory for the game to run properly, you could run cd /usr/local/games/quake3 && ./quake3 which you can save to a file in /usr/bin/quake3 so when you run quake3 the shell script will cd /usr/local/games/quake3 and if that runs with no errors the shell script will then also run ./quake3

At the moment I am pretty tired, so the quake3 game was the only thing I could think of off the top of my head that you would want to script the Linux cd command.

Linux File Info Command

The Linux file command is a pretty basic command in Linux that will output the file type information onto your screen. There are quite a few options for the Linux file info command, but I only use maybe 2 of the options on a regular basis. With Microsoft Windows it will always think that the extension of he file determines the file type. If you have a file named filename.txt Windows will automatically think this file type is a text file, when it could actually be a pdf file with a bad extension on it! Now Linux on the other hand, if you come across a file that has a bad extension on it, you can run file filename.txt and it will output: filename.txt: PDF document, version 1.4 or whatever version of the pdf format it actually is.

The main options of the file command that I use is file -f [filename], where [filename] would be a standard text file with a list of files you want to have checked. If using this option you will want [filename] to have 1 filename per line.

The other option I use often isn’t really an option on the file command, but is a short script. You can run file `ls` and it will output the file types of all of the files that the ls command outputs normally, which will be all of the files listed in your current working directory.

I hope this Linux tutorial for beginners has helped you learn more about the Linux file type information command.

List Files and Folders with Linux ls Command

The Linux ls command is used to list files and folders in a directory. There are tons of options to use on the ls command. I will not cover every single option that you can use with the linux ls command. I will cover the most common options for the ls command. If you don’t find what you are looking for in this Linux tutorial then I would recommend running man ls and reading the
man pages for the ls command.

The usage for the Linux ls command is: ls [options] [file|directory]

You can use the ls command without any options or as many options as you like.

If you just run ls with no options it will output the list of files in the current working directory in alphabetical order. So if you are in $HOME (which is the system variable for your home directory ( /home/username ). This will also not output any .* files or directories ( files or directories that start with . as they are hidden files|directories ).

Now if you want to list all files and folders in a directory you can use ls -a or --all option. This option will output all files and folders including the files and folders that match .* ( your hidden files and folders ). You can also use ls -A or ls --almost-all which will output all files|directories except for ./ and ../ ( which ./ is current working directory, ../ is your parent directory ).

Another common option for ls is using ls -b or ls --escape which will escape any special characters like spaces. This is more useful if you can not figure out which characters need escaped or if you are writing a script that needs the characters escaped.

ls -l will output the files and directories in long list format. Which means ls -l will output your file and directory permissions, hardlinks or entries, user, group, size (in bytes), month, date, time, filename|directory name.

ls -h will display the output sizes in human readable form, the highest available measurement. ( 1K 1M 1G.. etc ). This option has to be used with an option that outputs size as well. So either ls -s or ls -l but you would combine the options, ls -lh or ls -sh will work.

You can combine a number of options for ls to get the results you want, ls -lha will display the output of all files and directories in long list format with the sizes being human readable aka the highest measurement available.

You can also pass the output onto other commands using a pipe | so that you can alter the results more to specific needs. For example if you want to just see the sizes of files, and not filename or directory names: ls -sh | awk '{print $1}' will do this for you. If you wanted to display just the permissions of the files and directories, you could use ls -l | awk '{print $1}' which will give you those results. If you want more information on scripting like this I will be covering this in another section.

mkdir How to Create a Directory in Linux

For those of you wanting to know how to create a directory in Linux using the command line interface or Linux shell, you will want to read this Linux beginner tutorial on how to use the Linux mkdir command. The Linux command mkdir is used to make directories in Linux. There aren’t many options I use with this Linux command either. There is only 1 option I use
with the mkdir command on a regular basis.

The usage for mkdir is very simple mkdir [options] [directory].

Just remember when running mkdir that you are creating directories from the current working directory, unless you specify another path. So if I am in /home/max/ and I want to make a directory called images I would run mkdir images which will create the directory images in /home/max/ so now my complete path for images is /home/max/images/. Now if I was in /home/max/files/ and still wanted to create /home/max/images/ I could run mkdir ../images which ../ is your parent directory. I could also type in the full path on the command line by running mkdir /home/max/images to get the same results.

The option I use on a regular basis for the mkdir command is mkdir -p which will allow you to create parent directories if they don’t already exist. For example if /home/max/images/ didn’t already exist and I wanted to make a directory /home/max/images/family I could either make each directory individually by running mkdir /home/max/images then run mkdir /home/max/images/family. I could also script this slightly all in one command line, yet 2 separate commands by running mkdir /home/max/images && /home/max/images/family. So either way still having to type out many commands. Now instead of typing all the extras, i could simply run 1 mkdir command to create the parent directories as well using the mkdir -p option. Which I would then run mkdir -p /home/max/images/family and this will create /home/max/images and also /home/max/images/family as well!

I’ve also seen a lot of people asking how to make directories a through z with Linux? Well my first thought was to try mkdir [a-z], but unfortunately this will just create a directory named [a-z]. So in Linux to make directories a through z you have to make a small script type command. Here is the command you can run to create directories a through z, if you are wanting to organize mp3s for example: perl -e 'for (a..z) {system("mkdir $_")};'

SHELL NOTE: For anyone wondering in the example command line where I used mkdir /home/max/images && /home/max/images/family what the && does, the && on a command line separates shell commands and only runs the next shell command if the first Linux shell command ran successfully without any errors. So if for some reason mkdir /home/max/images failed, the shell would not run the next shell command mkdir /home/max/images/family.

As always thank you for reading this information on the Linux mkdir command for creating new folders and directories in Linux via the command line interface. If you have any friends you would like to teach how to run Linux, send them here to the beginner linux tutorial, where we will hopefully turn them into advanced Linux users or at least Linux users so they can get rid of that evil Microsoft product they call an operating system!

Linux Basic Commands Tutorial

There are many common Linux commands that will be helpful to you, if you ever even use the command line interface in Linux. Most average users just use the graphical user interface instead which usually has many tools and front-ends to Linux common commands. This Linux tutorial on command commands will help even the average user in case X server crashe
s, fails, is not properly configured, etc. So continue reading for some of the more common Linux bash commands.

Some of the more common Linux shell commands are listed below for more information on each command you can always run man [command] and this will bring up the manpage for that command, you can also click on the commands listed for some common examples and syntax.

First before I list them any syntax in [] will need some kind of input from you normally, for example:

man [command] you will want to actually replace [command] with the shell command you want to read the man page for: man ls will give you the man page for the Linux shell command ls.

linux ls command – is used to list files on the filesystem.
file – command that will check the filetype, this will output to you what the file type is no matter what the extension is.
mkdir command – used to make directories on the filesystem.
cd – is used for changing into a different directory in the Linux shell
cp – is the Linux copy command, this shell command is used to copy files|directories from one location on the filesystem to another.
mv – the Linux terminal command to move files|directories. Like the cp command, but deletes the original source.
rm – shell command in Linux to remove files|directories.
Linux cat command- this command is used to print|view the contents of a file to the screen|terminal.
grep – command used to search|find contents of a file and print|view on your terminal|screen.
Linux more and less – commands that will allow you to read output of files, unlike cat that will output the entire file at once, even if it is too large for your terminal more and less will output only as many lines as the shell you are in can output, and allow you to scroll through the file contents.
chown – Linux command to change ownership of a file|directory.
Linux chmod – command that allows you to change mode of user access|permissions, basically set read, write, and execute permissions.
Linux ps – lists the current running processes on your Linux system
Linux kill and killall commands – used to kill|terminate running processes