Tuesday 4 June 2013

Common Commands in Linux - Helpful if You're New to the Pi

How to make it work?



The Most Common Directories of the Raspberry Pi

bin = A place for binary commands which are fundamental for Linux, eg: ls cd top
boot = Contains files needed for start up / booting the system, this includes the kernel, bootloader configuration files and a RAM disk image
dev = Devices, hardware devices such as: soundcard, sd cards mouse keyboard, usb, hard-drive
etc = A place for the system’s configuration files
home = Home. The user’s home directories
lib = Library (all files, kernal modules and libraries can be searched for here)
lost + found = Files that appear in lost+found are typically files that were already unlinked, i.e. their name had been erased, but still opened by some process (so the data hadn’t been erased yet), when the system halted suddenly (due to kernel panic or power failure).
media = Is where external and removable devices such as usb hard-drives, CDs etc are mounted
mnt = Is where devices are temporarily mounted, eg: network file systems
opt = Optimise. A place where extra software, which isn’t handled by the package manager, can be stored
proc = Process. A virtual file system where the kernal can send information to processes
root = Root is the superuser’s home directory (great to boot with if the actual home directory isn’t an option)
run = A standardized file system location, available where users can store runtime information
sbin = Superuser Binary. More advanced binary files for the superuser to use in a terminal
selinux = Secure linux (security stuff, eg: administration)
srv = For data directories to do with the server, eg: FTP, HTTP
sys = System (contains info about the available hardware and kernal tasks)
tmp = Temporary data for files, eg: modifying spreadsheets, are temporarily stored here
usr = User applications / programmes
var = Variable data that can change quite quickly, eg: your own website, because you change it and it has to save some data)



Common Commands


apt-cache search = to search for an application (eg, apt-cache search gimp to search for gimp)
apt-get = used to install and remove applications (specific to Debian systems, must be run under sudo) eg, apt-get install htop
bash and sh are different terminals and terminal interfaces
bs = is the parameter for the dd command, it sets the bit size (ie, how big a chunk of data it copies at a time)
cat = shows you the content of a file
cd = is to enter a directory
chmod = to change rights (who can read / write / execute a file)
dd = is the application which copies an image or a disk down to a disk (basically it copies bits from A to B)
df -h = tells you how much space you have left on your system
du -sch = tells you the size of a catalogue is
exit = to log off your machine
grep = looks for a specific keyword in some data
grep | = looks for a specific keyword in some data that is piped to grep
ifconfig = to see your network configuration
init = used for rebooting your computer or shutting it down (eg, init 0 will shutdown your machine or init 6 will reboot your machine)
ls = listing directories and files, good for figuring out where you are in the system
ls -lah = same as above but with more info given
man = manual (the manual for all the commands eg, man ls to find the manual on the ls command
nano = used to edit files (it’s like notepad)
ping 8.8.8.8 = handy to see if you have an internet connection (8.8.8.8 is Google)
q = quit in an application
sudo = you use it to run commands as the superuser
top = to see what’s running on the system right now
users = allows you to see users who are logged on to the system (local users)
w = gives you system information (eg, uptime, cpu usage ...)
-X = This is called "X Forwarding", it forwards applications with a graphic interface to your machine and here is the code you'd need to type in: ssh pi@192.162.1.123 -X


TAB Twice = to predict the rest of the command or file name you’re writing
UP and DOWN Arrows = used to access your history (good for cutting and pasting commands)


To overwrite your SD card

type disk util list to show the disk devices and show which disk you are going to write to.


Hope this helps, have fun!
- N




No comments:

Post a Comment