Text-based computer terminals had their hay day in the 60’s & 70’s then punch cards came into existence and with further advancement of technology MS-DOS saw the day (in 80’s).
GUIs or the graphical user interface is the hand through which the user manages the machines – computers, I mean. Be it Mac, Linux and Windows all are pre-loaded with the respective GUI. Even then, the basic tenet has not yet become obsolete. All the tasks like previously can be still be concretized by typing text commands into the terminal or command prompt/ cmd as windows call it.
Does this imply that giving external hardware to the user – in form of mouse – is an extended version of these terminals? Well, not exactly.
GUIs have their own limitations unlike the text commands that have the potential of controlling computers, which are not directly attached to it. Secondly and more importantly, they can dig into the realm where there is no GUI, specifically Web servers.
If we talk about servers then Linux Web servers are the ones, which have been shorn of all needless graphical software. No doubts, cPanel or Plesk can be employed as web UI but at times, this alone is not enough hence, the text commands come in handy.
Text Commands on Computer
On Mac with OS X, go to Applications → Utilities, and run Terminal. On Ubuntu Linux, go to Applications → Accessories, and choose Terminal. On Windows, go to Start and then type cmd in the search box provided, immediately the DOS window will pop up.
Type ls or Mac or Linux and dir on Windows and then enter. It will display the current directory.
Secure Shell into Web servers
If you have dedicated server then you may have a decent entry. After all, you know the login credentials of your FTP, yes, same would be required to get access via this application as well. In case you are employing the cloud service then you need to request but if you are on shared hosting then it would be a problem. The administrator in the first place won’t give you the access.
On Mac or Linux type the following on the Terminal
ssh -l username http://www.myserver.com
where -l = log in as
On windows, it’s not that easy, need to download some SSH software like putty, an exe file, the only file format used by windows. Putty configuration is done:
1) Enter the host name and port as per the given boxes
2) Select SSH in connection type
3) And then Open
4) Enter the login credentials
You will see ‘$ sign’ which means, you have successfully logged into the web server and can start typing the commands.
i. Command pwd means the current location or the directory one is in
ii. Command cd changes the directory
iii. Command ls shows the content of a directory
Going ‘into’ the Websites
In Linux servers /var/www/vhosts is the location of websites. Once you enter in any of the websites present, you will get direct access to:
i. Website’s files- httpdocs or httpsdocs
ii. Configuration files- conf
iii. Logs & compiled statistics- statistics
iv. Private files- private
v. Others – error_docs
One can also change the website’s public-facing directory through myserver.com/httpdocs
Searching of file ain’t a daunting task either, find /var/www is the root.
Control+C is the command to interrupt a Linux command. Suppose you have to find some lost file then find /var/www is used, what if the data is huge plus, it requires a second command to filter? Then pipe cutting would be an answer, find /var/www | more
Adding a pipe ‘|’, allows different process to communicate and in here, it’ll take the output of one command and passes it to another command.
Searching also requires file name and the extension, and in here,
i. -name is use to name a file
ii. \* is the wildcard, is used for the file extension
iii. -o for ‘or’
An Addon: Command-Line Completion
A feature in Linux called command-line completion can avert monotony that might occur by typing full name of files again & again during changing directories and editing files.
Howto: Press Tab after typing the name of a file or a command.
Two probabilities: In case of one possibility, Linux will fill in as much as it can. But if there are more possibilities, Linux won’t fill, I mean, nothing will happen.
Press Tab again to show all of the possibilities.
These were the basic of some of the commands I’ve been using. I am still working on similar others, will be publishing in my next blog post once am through with them.