Uploaded by linuxbyexample on Nov 3, 2010
http://linuxbyexample.org
One way to check that your web site is running, is to ping the web server that your site resides on, and see if you get a reply. The command for this is ping, followed by the number of times you want to connect to your server, specifying the web site address you want to test. Here I am testing the Linux By Example web site.
As you can see, the server is responding, meaning that the web site is up and running. If I wanted to check this status out several times during the day, it would soon become tedious having to re-type this command every time.
I know there are different ways, which save you from having to re-type commands, i.e. like searching your bash history, but that's one of the things I like about Linux, there is usually more than one way to achieve the same goal.
Personally, I find it easier to create an alias for a given command sequence, if it's something I am likely to use on a regular basis.
To see what alias commands your system already has set-up, you can simply type alias at the terminal prompt, which will give you a list of the current commands, and what shortcuts they are assigned to. Here you can see the word grep has been remapped to use grep in conjunction with the colour switch, which saves you having to specify this option on each grep command, effectively giving you auto colour highlighting by default.
To create a new alias command, we simply type alias, followed by the letter or phrase we want to use, equals, followed by the actual command sequence we want to perform. The command sequence needs to be enclosed in single speech marks.
So in this example, you can see I am assigning the letter w to the ping command we used earlier. If we now just type alias again, we can see that the command has been set-up, and just typing w will check that our web site is responding.
If you need to remove the alias from the letter w, just use the un alias command, specifying which reference you want to stop using. As you can see, the w reference has now gone from the listing.
Using the alias command in this way, only makes the aliases work for the current terminal session, and if your computer is rebooted, then the settings are lost. To make them permanent, you need to add them to your .bashrc file, which can be found in your home folder.
Here is my home folder, and under Linux all dot files are hidden by default, so you will need to use your file managers view options, to turn on hidden files. This function is commanly assigned to the keyboard shortcut of control plus H. Once the hidden files are made viewable, find the .bashrc file and open it in a text editor, here I am using gedit.
This is quite a long configuration file, so you need to use your text editors search facility, to search for the section which contains the default alias commands. Once found, you can create a new line, and enter the alias mappings you want to use, I am just going to paste in our ping example from earlier. Once you have saved the file, the new aliases will be available to you at all times.
If you would like more information on the alias command, there is a very good write-up on the Linux Information Project web site (http://www.linfo.org/alias.html)
Thank you watching, I hoped you found the video useful. Please subscribe to get notifications of new videos. Coming up next, how to backup your files off site using the Amazon S3 storage solution. Until then, goodbye.
Category:
Tags:
License:
Standard YouTube License
-
3 likes, 0 dislikes
14:28
Customising the Linux terminal using .bashrc (environment variables and aliases)!by DevHQLessons790 views
8:22
User-Friendly Linux with CLI Alias Shortcuts - VPS BIBLE # 7by guvnrDOTcom1,619 views
1:03
Securely Delete Files in Ubuntu.by unixmint1,169 views
10:55
bashrc/ bash tutorialby os10tutorials1,856 views
6:32
3. How to use Redirection in Linux Command Lineby sightcaster425 views
8:59
How to use the 'find' utility from the command line on Linuxby vid4ken3,485 views
3:04
Hospedaje Webby creamostuweb921 views
1:08
Use KDE and Gnome at the same time on Linuxby anchorschmidt253 views
7:35
Linux File Systemby wgbass2125,630 views
4:14
How To: Use Nested Commands in Linux (Beginner)by monstrado1,328 views
3:11
2. How to use the Pipe Operator in Linux Command Lineby sightcaster1,028 views
8:07
Tutorial: Terminal Commands in Ubuntu Linuxby AppleFreakTripleS8,417 views
0:53
grep commandby rancorbob784 views
4:26
Linux Terminal tip: Aliasby punkkid219236 views
1:55
OS Solutions - Alias Commands in Ubuntuby ossolutions216 views
3:48
UNIX/Linux seq command tutorialby jaduks6,691 views
3:43
BASH lesson 3 - grep and cut commandsby metalx100029,646 views
4:27
How to: Get Safari 3 on Snow Leopardby NO1MACFAN843 views
0:42
View Hidden Files and Foldersby srajure10,160 views
0:21
/lost+foundby thtsang1,260 views
- Loading more suggestions...
@theif519 Glad you found the video of some use, the Alias command is certainly very useful, especially when working on Linux servers.
linuxbyexample 9 months ago
I have to thank you for this one. Although I didn't watch the entire tutorial, I was trying to find a way to set the startx command for Gnome-session, but instead if brought up a black screen with 3 terminal windows, but if I specified the path name "startx /usr/bin/gnome-session" I could use GNOME3. So, thanks to your tutorial, I used the "alias='startx /usr/bin/gnome-session' and it worked like a charm! Many thanks from a Linux beginner
theif519 9 months ago