Common SSH Commands for Linux / CentOS / Red Hat

Posted on January 22, 2015
by Seth Harden

Folder Navigation

Move into a directory:
cd foldername

Go up a directory level
cd ..

Go back to home directory
cd ~

Create a new folder
mkdir [directory name]

Files

Change file permissions
chmod 755 index.php

Delete a folder / directory and all of its contents:
rm -r -f

Create or edit a file
vi newfile.txt

Read a file
cat index.html

Delete a file
rm oldfile.php

Unzip a file on the server
unzip filename.zip

System Information

Show processes currently running on the server
ps -auxf

Other SSH Commands
Check Your INODE Count / Usage

Plesk Login Gives You a “502 Bad Gateway” Nginx Error

Posted January 6, 2016
by Seth Harden

Plesk isn’t quite sure the cause of this error but it seems to possibly be linked to exceeding your virtual disk space quota.

Here’s a fix that has worked for me.

Access your server via SSH.

Then you will need to edit the following file /etc/sw-cp-server/config

I typically use vi editor to edit files inside of SSH

So the command will be vi

Then scroll down till you find:

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
Use the r button to write over 16 and 32 till you have:

fastcgi_buffers 32 32k;
fastcgi_buffer_size 64k;
Then press shift+:
Then type in wq! which will save the file and quit vi editor

Next, restart the following services:

/etc/init.d/sw-cp-server restart
/etc/init.d/sw-engine restart
You might get an error when restarting sw-engine about exceeding your disk quota. If so check out this article I wrote on cleaning off large files off your server:

http://programming.sethharden.com/find-largest-files-on-server/

That should solve your issue.

How to Change Your Root Password on Mac OSX

Having trouble logging into your root user account on your Mac using SSH Terminal?
It’s either because your root user is not activated or you need to reset / change the password.

Here’s what you do.

1. Go to System Preferences
2. Click on “Users & Groups“
3. Click on “Login Options“
4. Next to Network Account Server: click on the “Join…” button
5. Click on “Open Directory Utility…“
6. Click on the lock to make changes.
7. Now go to the top menu and go to Edit > Enable Root User
8. Now go to Edit > Change Root Password

Done!

What are the best programming languages to learn?

Posted on July 19, 2016
by Seth Harden

Inevitably when I meet someone who wants to pursue computer programming they ask me “what are the best languages to learn?”

I’m going to attempt to answer that question directly without going off on a nerd analysis tangent.

The first thing you should decide is whether you want to code software such as Microsoft Word, websites such as Facebook.com, or Mobile apps such as angry birds. Granted there is a lot of overlap with each language and, as with anything you doing life, the broader your knowledge the more success you will have.

There are also countless programs out there that allow you to build software, websites, and applications in an easy drag-and-drop in her face but that’s not considered “coding” and it will get zero street cred inside the programmer community. Also, along with code there are certain hardware and firmware systems you should be familiar with.

Let’s start with languages for someone wanting to design software for Windows or even their own operating system.

I personally started by learning Visual Basic as it’s easy to learn and will get you going and excited because you’ll be able to create something fairly quickly. From there I would learn Java (not to be confused with JavaScript), C++ (then tack on C#), and if you want to do an operating system you should learn Assembly language. Python is a relatively new language that a lot of developers are starting to use, if you know Java and C++ you can learn Python quickly. If you can master these 3 languages you will be able to create pretty much any software you can think up. You should also know your way around a Unix shell and be able to execute some Bash scripts.

Next, here are the languages for someone wanting to do website development. Start with HTML (now HTML5) as it’s the basic structural language for website design. Next you will definitely want to learn JavaScript (not to be confused with Java). From there I personally would learn PHP and understand SQL in order to operate a MySQL database. If you want to be able to style your websites beautifully you need to learn CSS and the basics of Bootstrapping a website. With these languages you can build almost any website. If you want some advanced skills I would learn either Angular.js or Backbone.js (both are advanced JavaScript languages used for more dynamic frameworks) a lot of apps use these 2 languages because they allow for dynamic page processes. jQuery and Ajax can also be useful for dynamic site design but You’ll also want to understand how to host files on a server so knowing what a domain name is, IP address, name servers, and the basics of a server OS like Linux or CentOS. Brush up on virtualization software like Parallel’s Plesk or cPanel and the Apache web service framework. You most likely will have to do some root access work so understand SSH terminal commands.

For someone wanting to create an app there are different languages for iOS (iPhone and iPad) or Android (every other smartphone lol). I would personally develop using web languages as you can then deploy on both devices without too much customization. JavaScript and HTML5 work great but you really should develop in either Backbone.js or Angular.js as these are much more dynamic. You should understand the systems related to web development as well – especially MySQL for anything with a database.
For both website and app development you should know your way around a Linux command prompt and understand the basics behind SSL certification and HTTPS for anything e-commerce related.

XML-RPC and CSV are useful for data tables and should be understood. Also if you want to integrate 3rd party applications like a Facebook login you need to know how an API works.

Want to be considered a full stack developer? Here is a list of all the languages from above:
Java, C++, Assembly, Python, HTML, JavaScript, jQuery, Ajax, CSS, PHP, Bootstrap, Angular.js or Backbone.js, BASH Scripting, SSH, MySQL, XML-RPC, CSV.

Systems:
Linux, Windows, iOS, Android, Apache, Unix Shell, SSL, HTTPS, IP address, domain naming, name server, API, Plesk or cPanel.

For iOS or OSX (Apple) specific development you should know Xcode or Swift.

There you have it! Just a few years of education and you can build the next million dollar app!

What about Ruby on Rails, Perl, Curl, Objective-C, Cocoa and JSON? Ya, if you want to learn those then be my guest.

Spotify vs. Tidal : What is the best streaming music service app?

Posted on July 16, 2016
by Seth Harden

I was jumping for joy and fist pumping when I heard the, Europe based, streaming music service Spotify had signed deals with U.S. record labels and was finally coming to America. I used the service a few hours before signing up for the $9.99 premium plan.

“YOU GUYS GOTTA CHECK THIS OUT!!!” I yelled through the office. By day’s end every single person in the office had downloaded Spotify on their work computer. Over the next year I preached Spotify to every person I came in contact with as if I had discovered the Internet itself. Spotify had finally solved my music access dilemma. For the price a cold sandwich I had my music fix covered. No more bit torrents and guilt from music theft, no more organizing my overwhelming digital archive of Mp3s, and no more surfing through countless pretentious indie blogs to find new music. As a deep deep music lover, Spotify was the savior of my music listening world.

My only problem with Spotify was its lack of brand culture and re-investment in music culture. Even MySpace made attempts at contributing something to the music community, it started a record label, sponsored concerts, and featured new artists on their homepage. Spotify felt like just an app, like a corporation, focused on a bottom line, exchanging money for services. All I knew about the company was Sean Parker’s appointment to the board of directors, most likely an attempt at legitimizing Spotify with the old Napster, anti-establishment, community. Spotify seemed content with only playing the role of technology creator and stayed out of the music community entirely. To further damage their image, it became clear early on that artists were barely being compensated for their music streams.

Introducing Tidal, claiming to pay 75% of revenue back to music labels for artist distribution. Tidal was acquired early on by Jay-Z for $5 million and marketed as the first “artist owned” music streaming service. With a monthly subscription fee of $9.99 (the same as Spotify) it also offers a HiFi subscription for $19.99 which provides lossless streaming of Flac files at 1411 kbps (the same as a traditional CD).

I signed up for a free month of Tidal HiFi to see if there was a noticeable difference in sound quality. First, let me say the sound quality is NOTICEABLY different. I found myself listening to my favorite songs just to hear parts of the music instrumentation I hadn’t been able to hear with higher compression. The sounds were crisp, the vocals were vibrant, and the music just …sounded better. The only downside was my limited 10GB monthly Verizon phone plan. I was already coming close to overage charges each month, and with Tidal’s significantly larger file size I would definitely be incurring additional data charges. To get around this I immediately made playlists and downloaded the tracks over WiFi for playback while I was in my car. You can also set mobile streaming to a lower quality, but HiFi streaming is the whole point of the Tidal service!

The interface of Tidal is much cleaner and uses a better font in my opinion. Another HUGE component of Tidal is their music video catalog! No more watching videos on YouTube with ads and popups. Along with music videos, Tidal produces music shows and concerts that stream beautifully on both the desktop and mobile app. Tidal is built using backbone.js while Spotify is still using Java, Python and Clojure – someone at Tidal really knows what they’re doing. I don’t like how they crop the album cover into a circle while the song is playing, it looks stupid and doesn’t allow you to see the whole album artwork. One of my favorite Tidal features is its lack of the social network feature! No more embarrassment when you play Abba’s Dancing Queen as your music selection isn’t broadcast to your Facebook friends.

The best thing about Tidal is the sense you get that the people running the show are passionate music lovers who care more about music distribution than app creation. Although, main owner Jay-Z has featured his wife (Beyoncé) on the home page for the past two months… favoritism?

Unfortunately, the party is about to end just as it’s getting started. Apple just met with Tidal to discuss an acquisition to the tune of $500 million. Even though Tidal only has 4.2 million subscribers compared to Spotify’s 30 million, Apple must see what I see – a superior music service just a few years away from taking that top spot.

SSH Restarting Apache

RESTART APACHE 2

/etc/init.d/apache2 restart

START SERVICES

APACHE WEB SERVICE

 /opt/psa/admin/bin/websrvmng --start

PLESK WEB SERVER

/etc/init.d/sw-cp-server start

PLESK PHP ENGINE

/opt/psa/admin/sbin/pleskrc sw-engine start

DNS SERVER BIND

/opt/psa/admin/bin/dnsmng  --start

RESTART APACHE 2

[/code]plesk db[/code]