Archive

Posts Tagged ‘ssh’

The Basics to Working Within a Linux Terminal

April 13th, 2009 admin 6 comments

So I’ve had some break time before that project is finally due so I’m taking it to write a little something about the Linux terminal. (The first item I’m addressing off the list 2 posts below)

So what is a Linux terminal? Well, to keep it simple, it’s the computer’s interface. For those of you (probably the majority) who are Windows users, Linux does not come standard with a GUI, but rather you must download a 3rd party interface such as GNOME if you need one. Also, to keep it related to Windows, the Linux terminal is equivalent to Microsoft DOS’s command prompt. Now, I don’t want any of you to get confused and think that Windows and Linux are the same because they are not even close on any level. I think it is safe to say that their only certain comparison is that they are both Operating Systems. While Linux seems to be the system of preference, most users prefer Windows to use as their home PCs or what have you.

Now that we’ve got that out of the way, why is this tutorial just on the basics rather than everything with the terminal? Well, not to mention there is far too much to learn in just one post about the terminal, the basics will work across ALL Linux and *nix (and probably most BSD) operating system distributions (distro). Note that there are many distros such as the infamous RedHat Linux, Debian Linux, Ubuntu, and FreeBSD (a BSD system) all of which function fairly the same although each have arguable advantages over the other.

The Linux terminal is also very often referred to Shell Access (or SSH) by hosting companies. This can be a VERY useful tool for web developers who need to create things such a cron jobs or use system commands which they could not usually use with the standard FTP access.

With all that said, we’re ready to begin. This guide will more or less be a list of functions followed by their purpose and what some may do in an actual environment!

The format is as follows: COMMAND <required param> [optional param]

ls [directory] – Will list the files in a given directory
cd <directory> – Change to a different directory
ps aux – View processes
ps aux | grep <process_name> – Will find a given process by name if it’s running
find <directory> -name <file_name> – Find a file by name. For example, if you use find / -name w00t* it will return the paths of ALL files beginning with w00t
rm [-params] <file>- Will remove a given file or files. To remove a directory you must use rm -rf <directory> NOTE: Linux (without GUI) has NO trash bin, so anything you use rm on is removed FOREVER!
cp [-params] <file> <dest> – This will copy a given to file to a give destination
top – View processes and memory usage in realtime
df -h - See system partitions and usage (The -h parameter puts sizes in Megabytes instead of blocks)
uptime - Uptime information as well as system load averages
su - If you have root login information and are logged in as a regular user, use this command to grant root access (su = super user)
chmod <file_or_directory> <PERM_LEVEL> – Especially important for web developers. Different from windows, this is file access level. For web pages, 0644 is the standard and for directories it is 0755. 0777 for any file you want to give full permissions to (write access: e.g.: ability to upload files into the directory from a PHP upload script or something)
mkdir <dir_name> – Makes a directory

That’s a basic list and should be a more or less helpful guide to anyone who is starting to Linux! Enjoy and look out for the new articles to come out soon! ;)

Regards,
Dennis M.

Categories: Other Tags: , , , , ,