Raspberry pi (linux) basic commands Terminal commands

If you do make a mistake on your raspberry and its messed up (which happens a lot to begin with).
please refer to my install image guide to start again Install Image to sd card

These are some of the very basic linux commands to use in the terminal. There for real beginners just to start you off with some simple commands for the raspberry pi. Unless you are using the terminal as a root user most commands will require the word sudo before eg (sudo raspi-config).

The first thing to do is open the terminal google that for your OS its easy to find out. Once terminal open you need to log into the raspberry pi this is done with ssh command.
ssh pi@

The default password is raspberry once entered a security warning may appear in terminal just type y and enter password.

The first thing to do is run the command
sudo raspi-config

This will bring up this screen.
From this screen i recommend you change your password & expand your memory card you can do other things get the update overclock etc look around. Once the changes I've recommended are made restart the raspberry pi with.
sudo reboot

If you're not using a computer and start your pi through your tv HDMI this screen will come on on the first time boot so have a keyboard handy.

The rest of these can be used on all linux based systems i use on beaglebone ubuntu and pi

The first 2 commands to run will update your OS always run after new install updates OS to latest version.
sudo apt-get update
sudo apt-get upgrade

This code allows you to set or change a password for users. It can be used for any user eg sudo passwd pi.
sudo passwd root

This is handy if you like messing with your raspberry pi settings programmes etc wiping your sd reinstalling the OS playing a lot (I DO) you will get a message saying key untrusted enter this code to clear ssh keys to allow reinstalled OS to run. Its a security thing.
echo "" > .ssh/known_hosts

This allows you to go into the root user if you havent set a password then your default sign in password is used.
sudo bash
sudo -i

This allows you to view all the device addresses for wireless ethernet usb etc.
sudo if-config

This is to shutdown or restart your device.
sudo halt or sudo reboot

This is to view your devices hard drives.
sudo blkid

If you want to have a VNC (virtual network connection) which is basically mirroring the desktop from the pi to you chosen VNC viewer install this. Then google vnc for windows mac and download a vcn recommended software for your OS
sudo apt-get install xrdp

This is to find a file.
find / -name home.php Find specefic file
find / -name *.jpg Find all jpgs
find / -name home.* Find all files with name

This is to display and edit text files.
sudo nano/etc/apache2/apache2.conf

This is to display but not edit text files.
sudo cat /etc/apache2/apache2.conf

This can be used to change file permissions when editing files on my site some have different permissions so i have to change them. Be carefull what permissions you give what files eg a comment page needs permission to write where as a simple webpage needs only view permission
chmod 0770 /var/www