unix – Internetblog.org.uk https://www.internetblog.org.uk Web hosting, Domain names, Dedicated servers Fri, 29 Jan 2016 11:05:52 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 https://www.internetblog.org.uk/files/2016/01/cropped-favico-32x32.png unix – Internetblog.org.uk https://www.internetblog.org.uk 32 32 Searching with GREP https://www.internetblog.org.uk/post/1566/searching-with-grep/ Fri, 23 Jul 2010 20:08:50 +0000 http://www.internetblog.org.uk/post/1566/searching-with-grep/ GREP, which stands for global regular expression print, is a sophisticated Linux/Unix tool that can serve many purposes, but one useful purpose on a dedicated server is its ability to search files and directories. With grep you can search within multiple files with relative ease. You can also parse printed screen data to simplify results.

To search a file, just enter “grep” followed by the search term and then the filename. For example, to search the file “httpd.conf” for the word “localhost”, you would type:

grep localhost httpd.conf

To use grep, to simplify printed screen lists, use the following format:

ls -al /usr/bin | grep make

This will list all of the files in the /usr/bin directory, but will only display those files that contain the word “make”. For more in-depth documentation, including use of regular expressions, type “man grep” from the command line.

Photo Source: Wikimedia Commons

]]>
Easily Repeat Root Commands with History https://www.internetblog.org.uk/post/1561/easily-repeat-root-commands-with-history/ Thu, 22 Jul 2010 15:36:55 +0000 http://www.internetblog.org.uk/post/1561/easily-repeat-root-commands-with-history/ Password keys iconPreviously, I mentioned some of the benefits of using the “history” command to display any or all of your previous commands. On dedicated servers, whether Linux or Unix, that use “sudo” rather than “su” to become root, it can be aggravating when you type a long command string only to realize you forgot to type “sudo.”

One easy solution is to press the up arrow, move over to the beginning of the string, and add sudo. But there is an even easier way to replay the command with root permissions.

Right after you have entered the command missing sudo, just type the following:

sudo !!

This will automatically run the last command in the shell history with whatever you place before it (in this case “sudo”). It is quick, easy, and gets the job done. In fact, you can use “!!” any time you want to repeat the previous command. Log in to your server via SSH and give it a try.

Photo Source: Wikimedia Commons

]]>
How to Connect via SSH https://www.internetblog.org.uk/post/1502/how-to-connect-via-ssh/ Tue, 06 Jul 2010 19:03:02 +0000 http://www.internetblog.org.uk/post/1502/how-to-connect-via-ssh/ SSH secure iconSSH stands for Secure Shell and is a secure encrypted method of connecting to a server for shell/command line access. It can be useful for shared hosting, virtual private servers, and dedicated servers. Linux server usually come with SSH enabled by default, although some web hosts may disable it for shared hosting accounts.

To connect to your server via SSH, simply type:

ssh -l(username) hostname_or_ip

It will prompt you for a password. Type your password, and you should be connected. Some web hosts may use a different port for SSH, other than the default port (22). If so, you will need to specify it, for example:

ssh -p 2222 -lmyname webserver.com

Normal Linux/Unix shell commands apply, once you are logged into the server. When you are finished, simply type “exit”.

]]>
Quick and easy sudo trick for servers https://www.internetblog.org.uk/post/1461/quick-and-easy-sudo-trick-for-servers/ Wed, 23 Jun 2010 18:58:00 +0000 http://www.internetblog.org.uk/post/1461/quick-and-easy-sudo-trick-for-servers/ keysQuestion: I just typed a really long complicated command line string on my server, but I forgot to type “sudo” at the beginning. Is there a quick way to enter it again?

Answer: The history feature in Linux and Unix-like operating systems is truly a beautiful thing. With it, you can easily re-enter commands. But what do you do if you need to re-enter a command but need to add “sudo” to the beginning? On Ubuntu, Mac OS X, and many other servers, “sudo” is the default method used to gain administrative rights, but it must be entered before each administrative command.

There are two ways to fix this. One is to simply press the up arrow. You will again see your command exactly as you typed it. To add sudo to the beginning, press the “Home” key, which should move the cursor to the front. Then, all you have to do is enter sudo, add a space, and press Enter.

An even quicker method is to use “sudo !!” to automatically reload the command with sudo. This will look to the last command entered in the “history” list and run it again. You can also use “!!” without sudo anytime you want to quickly run a command again.

Image Source: Wikimedia Commons

]]>
Disadvantages of Proprietary Unix https://www.internetblog.org.uk/post/1291/disadvantages-of-proprietary-unix/ Fri, 07 May 2010 22:29:36 +0000 http://www.internetblog.org.uk/post/1290/disadvantages-of-proprietary-unix/ IBM blade server rack
In a previous post this week, we examined various free Unix-like operating systems that were direct competitors with Linux, but there is another type of Unix-like operating system that still largely occupies many of the enterprise servers on the Internet. Those unices are proprietary creations of commercial companies like IBM, which created AIX, and HP, which has HP-UX.

Unlike free and open source operating systems, true Unix has been locked up for years with licensing issuses, patent disputes, and the dreaded vendor lock-in. Even IBM and HP versions are not immune to the last problem. When a major company’s product reaches the end of its shelf life, what do you do? Most end up having to spend thousands to replace their systems and sometimes even their applications as well.

For web hosting, which rarely requires specific applications that the big companies might provide, there is really no sensible reason to opt with one of their proprietary systems. Even though Linux, for example, is free and open source, there are commercial companies that will support it. The difference is that you can leave that company and choose another or stop paying for support altogether at any time.

Photo Source: Flickr

]]>
Preventing Viruses with ClamAV https://www.internetblog.org.uk/post/1276/preventing-viruses-with-clamav/ Tue, 04 May 2010 21:24:13 +0000 http://www.internetblog.org.uk/post/1275/preventing-viruses-with-clamav/ ClamAV logoMany people who run Linux or Unix servers think they do not have to concern themselves with anti-virus software because those operating systems are not commonly attacked by viruses. What they fail to realize is that a Linux server, particularly the mail server running on it, can still distribute viruses, effectively acting as a carrier.

Clam AntiVirus or ClamAV is a free anti-virus toolkit that detects and effectively removes viruses before they can infect a system or be passed on to others. It has a command line virus scanner, a database updater that pulls new virus definitions from the central server, and a daemon to run as a background service.

In order to scan incoming mail, ClamAV requires a mail filter, such as MailScanner. ClamAV is free and open source software, released under the GPL. It is available in most Linux distribution repositories, as well as BSD, Solaris, Mac OS X, and other Unix operating systems. There is also a separate organization that maintains a Windows version called ClamWin.

]]>
Linux vs. Other Free Unices https://www.internetblog.org.uk/post/1268/linux-vs-other-free-unices/ Mon, 03 May 2010 18:44:48 +0000 http://www.internetblog.org.uk/post/1268/linux-vs-other-free-unices/ Free software mascots having dinner
Linux is undoubtedly the most popular Unix-like operating system, and it is increasingly becoming the number-one choice for web servers, virtualization, and cloud computing. But it is not the only Unix-like OS on the map, and there are a few that rival Linux in terms of stability, security, and ease of use.

Among the most likely candidates to compete with Linux for the title of “Server King” are Solaris and BSD. Solaris was originally produced by Sun Microsystems, which has since been acquired by Oracle. One might consider the future of this OS as uncertain, but a free and open source version, OpenSolaris, ensures that the community can keep it alive even if Oracle does not.

BSD, originally created at the University of California in Berkeley is the primary Linux competitor in the server market, with several variants of its own that are similar to the Linux distribution model. Some of the more common include FreeBSD, NetBSD, and OpenBSD. OpenBSD in particular is known for its security-oriented development, and the creators of it are also responsible for OpenSSH, the secure shell server and client. In the coming weeks, we will look at both of these operating systems and see how they stack up against Linux.

Photo Source: Flickr

]]>
How to rename multiple files in Linux https://www.internetblog.org.uk/post/1111/how-to-rename-multiple-files-in-linux/ Thu, 18 Mar 2010 16:13:26 +0000 http://www.internetblog.org.uk/post/1111/how-to-rename-multiple-files-in-linux/ Tux, Linux mascotThe ability clusters of files is a handy skill to have when running a dedicated server or VPS, and in some cases, it is absolutely necessary. For example, if you ever need to migrate from one server to another or from one software/application system to another, you might need to change bulk amounts of files for the sake of compatibility.

Renaming one file is easy with the “mv” command:

mv filename newfilename

To rename multiple files, you need the “rename” command. Before the rename command, Unix system administrators had to rely on complex scripting to perform batch renames. Now, if you want to change all your .html files to .htm files, for example, it is as simple as a one line command string:

rename .htm .html *.htm

This will find all files that end in .htm (*.htm) and replace the .htm with .html. This works well for simple renaming schemes. For more complicated ones, you still need some scripting expertise.

]]>
iPhone and smartphone SSH with WebShell https://www.internetblog.org.uk/post/1091/iphone-and-smartphone-ssh-with-webshell/ Fri, 12 Mar 2010 21:33:20 +0000 http://www.internetblog.org.uk/post/1091/iphone-and-smartphone-ssh-with-webshell/ Webshell screenshot
You cannot be at your desk 24/7 even if you are the best system administrator the world has ever known. You also cannot predict when your server will need attention or where you will be when it does. We live in an age where mobile devices are as common as clothing, so it is only natural that web servers should be accessible from mobile devices as well.

Enter: Webshell, a cross-platform mobile SSH tool that allows the user to access a remote server on a computer, iPhone, or any other mobile device that has a web browser. Webshell is written in Python and therefore runs on any Unix-like system, including Linux, BSD, and Mac OS X.

Webshell supports multiple terminal emulations, UTF-8 enconding, including chinese/japanese glyph support, a virtual keyboard for iPhone users, customizable appearance, and maintains all of the security of SSH since it still operates over SSL/TLS. Webshell is free and open source software (GPL) and available for download from the project’s website.

]]>
Severe OpenSSL security vulnerability announced https://www.internetblog.org.uk/post/1066/severe-openssl-security-vulnerability-announced/ Fri, 05 Mar 2010 21:30:03 +0000 http://www.internetblog.org.uk/post/1066/severe-openssl-security-vulnerability-announced/ HTTPS

Web server administrators should take notice of a “severe” vulnerability that computer scientists have discovered in OpenSSL, the free and open source encryption software package for Linux and Unix-like systems.

The bug is in OpenSSL’s cryptographic library and vulnerability allows attackers to retrieve a server’s cryptographic key, leaving any secure transactions, such as banking and sales, exposed to the attacker. Hundreds of thousands (perhaps even millions) of businesses, banks, and other enterprise-level institutions depend on SSL encryption security, particularly that of OpenSSL.

Those who discovered it said that the attack is difficult to execute, but administrators should still be cautious. An OpenSSL spokesperson said that they are already working on a solution and will release a patch for the software. Furthermore, an attack requires access to the power source of the device, making it unlikely that an attacker could exploit a server, since most attack remotely.

Source: The Register
Photo: Ivan Petrov

]]>