Total Pageviews

Wednesday, 18 June 2008

Ubuntu System Administrator Course. Chapter 2. How to Ubuntu Server command line survival

Hi there you have installed Ubuntu server and wondering... what now!!!!

The Server Version of Ubuntu is text based, uses the command line to operate it.
It may seem limited at the beginning (no mouse no icons etc), but what you have in front of you is one of the most powerful operating systems in the world or universe, I am sure that if there is live in another planet they are running some kind of Linux!!!.

It's free, so everyone can have access to it, it is designed and maintained by the best engineers in the world, I love Linux...... sorry lets go back to the command line chapter.

Ubuntu Command Line Survival.

To be or not to be root?

Ubuntu Server offers the sudo mechanism that enable any user on the sudoers list to perform administrative task with root privileges.
Or you can use sudo su and sign in as root. We will go back to this later.

What the hell is the Shell?

All Linux distributions are a compiled kernel, Ubuntu uses the kernel to address and control
the machine's hardware.

The shell interprets the commands that a user type and translate them to machine code.
There are different Shell flavors :

  • tsch: A shell with a scripting language that works like the C programming language
    (and thus fairly popular with C programmers).
  • zsh: A shell that is compatible with Bash, but offers even more features.
  • sash: The stand-alone shell. This is a very minimal shell that runs in almost all environments.
    It is thus very well suited for troubleshooting systems.
and the Bash Shell named after bourne again shell.

Working with the Bash Shell.

The Bash environment works with a list of commands, ls, cd, rm, etc.
If you need a list of the available commands on your system you can press tab twice
and a list will come up.



Working with Directories

  • cd: The cd command change your directory, usage : cd /root will take you to the root directory.
  • pwd: stands for print working directory, usage : pwd will print your current location.
  • mkdir: creates a directory , usage: mkdir manuke will create a directory named manuke.
  • rmdir: removes a directory, rmdir manuke will remove manuken from your system, is manuken is empty if not you will have to use rm -r.
Working with Files

  • ls : when typing ls in the command line, a list of all the files of your current directory will be printed. A very useful command is ls -l it lists all the files and the permissions of these files, we will talk about permissions later on this course , apart from -l ls have many options aswell.When working with the ls command, wildcards can be used. So, ls * will show a list of all files in the current directory, ls /etc/*a.* will show a list of all files in the directory /etc that have an “a” followed by a dot somewhere in the file name, and ls [abc]* will show a list of all files whose names start with either an “a,” “b,” or “c” in the current directory. But something strange happens without the option -d. If a directory matches the wildcard pattern, the entire contents of that directory are displayed as well. This doesn’t really have any useful application, so you should always use the -d option with ls when using wildcards.
  • rm: It is used to remove file; rm hello.text will delete hello.text.
  • cp :copy files

Viewing the Content of Text Files

When administering your server, you will find that you often need to modify configuration
files, which take the form of ASCII text files. Therefore, it’s very important to be able to browse
the content of these files. You have several ways of doing this:

  • cat: Displays the contents of a file
  • tac: Does the same as cat, but displays the contents in an inverse order
  • tail: Shows just the last lines of a text file
  • head: Displays the first lines of a file
  • less: Opens an advanced file viewer
  • more: Like less, but not as advanced










No comments: