Linux is the operating system that powers over 90% of websites on the internet. If you’ve ever hosted a website before, then you probably have some level of experience with Linux in the form of it’s more user-friendly cousin: cPanel.
To become an expert at cloud computing, however, you’ll have to learn how to operate Linux servers without the help of a graphical user-interface such as cPanel. Although it may sound intimidating at first, getting comfortable with operating Linux servers starts with getting comfortable using the Linux Shell.
What is the Linux Shell/Terminal?
The Linux shell, also commonly referred to as the ‘terminal‘ is the gateway to the back-end of your web server. It uses a ‘command-line-interface’, which doesn’t include the pretty-icons and user friendly experience found in ‘
Getting Started
In this tutorial, you will learn the basic Linux commands for beginners who are getting started in Cloud Computing. Each of the commands listed in this tutorial are the most commonly used commands in the WordPress on Google Cloud tutorials on onepagezen.com.
View by Category
1. User Permissions
-
sudo
2. File and Directory Management
-
touch
-
echo
-
cat
-
mkdir
-
mv
-
ls
-
wget
-
find
-
stat
-
chmod
-
rm
NOTE: Remember to move your myfile.txt file back to the home directory. You can do this by running mv /home/mydirectory/myfile.txt /home
3. Apache Server Management
-
apachectl
-
httpd
Bitnami Apache Server Configurations
-
/opt/bitnami/ctlscript.sh
4. Virtual Machine Management
-
lsb_release
-
df
-
man
Did it Work?
This is just a small list of the most commonly used Linux commands, there are literally hundreds more!
If you thought of any important commands that were missing from the list, or if you would like to share a question or comment, please post your message below!
Thanks,
Ahmed Bazuhair says
Hi I can not do anything when I enter sudo telling me it was not connected
Do you have any ideas to solve this problem.
Leron Amin says
Hi Ahmed,
When you enter
sudo
it needs to be followed by a command, for examplesudo mkdir jsfiles
would make a directory called ‘jsfiles’. Does this answer your question? If not, please share more details about the error message.Thanks,
Joe
Ahmed Bazuhair says
See elcome to Cloud Shell! Type “help” to get started.
was12382 @ endless-cabinet-198419: ~ sudo apachectl restart
sudo: apachectl: The command does not exist
Leron Amin says
Hi Ahemed,
You’re seeing that error because you’re running the command in cloud shell. The command needs to run in the shell that is specific to the VM instance that you wish to connect to.
Navigate to Compute Engine > VM Instances, then click the SSH button next to the instance you wish to connect to.
Hope this helps 🙂
Joe
Ahmed Bazuhair says
root@oilyemen-vm:~# ØŒ stat -c “%a %n” /home/myfile.txt
-bash: ،: command not found
root@oilyemen-vm:~# stat -c “%a %n” /home/myfile.txt
stat: cannot stat ‘/home/myfile.txt’: No such file or directory
root@oilyemen-vm:~# stat -c “%a %n” /home/myfile.txt
stat: cannot stat ‘/home/myfile.txt’: No such file or directory
Leron Amin says
Hi Ahmed,
The file /home/myfile.txt is just an example – this file probably doesn’t exist on your system unless you deliberately created it.
This is why you’re seeing the error message
stat: cannot stat ‘/home/myfile.txt’: No such file or directory
Hope this answers your question,
Joe
Benjamin Waller says
Hello Joe,
How are you?
I’ve been looking through is list of commands to find an answer to my current problem but can’t see how to achieve it.
On my Mac, I successfully generated ssh keys via the SSH console from my GCP project and was able to saved the public key in my project inGCP. I watched this video to do that https://www.youtube.com/watch?v=R8C66NwMJLs
However, when i tried to copy the private key from .ssh folder on CGP to my desktop I got the following error: cp: cannot create regular file ‘/home/ben/Desktop/moodle-1_rsa’: No such file or directory. I think I am getting this message because the path in my computer is my system should be ~/home/benjaminwaller/Desktop/moodle-1_rsa
Do you know how i can copy from that key from GCP to my desktop when the username is different? I am trying to construct a command to do it but not sure… Someone like the following:
scp moodle-1_rsa :/Desktop/moodle-1_rsa
I found someone with a similar issue of stackoverflow and am trying to add username@ipaddress of my local desktop. And from the thread below the guy suggested cp -i so I am a bit out of my depth here.
https://stackoverflow.com/questions/27643519/cp-cannot-create-regular-file-users-james-desktop-no-such-file-or-directory
Pls let me know if you know how I should approach this.
Best regards,
Ben
Leron Amin says
Hi Ben,
Configure Google Cloud SDK and generate the SSH keys according to the instructions in this tutorial.
This is the recommended way to secure a connection between your local machine and your Google Cloud project.
Let me know if you have any additional questions,
Joe
Leron Amin says
What did you think about this tutorial?
Share your questions and comments!