Simple Linux Commands
Monday 5th November 2007 at 15:50

Here are some simple Linux Commands that I had written down on a piece of paper. I had been meaning to put them all on this web site with a few Vi commands.

I will look to keep updating this page as much as I can. When my office is finished, one of the machines is going to be a Linux one.

apt-get update

apt-get upgrade

Upgrade Linux setups and current system. This helped me during installation.

apt-get install ssh

apt-get install sshd

This helped me when I was having problems getting Putty to work.

apt-cache search firefox

The above code will search the installations for firefox.

adduser dean

Use this to add a new user to the OS.

passwd dean

This will allow you to change the password for user dean.

smbpasswd -a dean

Use this to add a new samba user.

su user2

This will let you change user in a terminal window.

These Website will give you a few more options with Users, I needed these when configuring the servers.

Linux Users

Linux Add Users to Groups

uptime

This will display how long your machine has been up and running for.

halt

Use this command to quickly shut down a machine.

Helpfull Linux Web Sites

Linux Admin.

Samba web page.

List of Debian software.

CHMod

Recently I had a problem on a linux machine where somehow, somebody had created a file that only they and administrators could access. This was a shared folder so it needed fixing.

First I thought I had fixed the problem after running the following command.

chmod 777 dirname

But this only changed that directory, and not the included files and folders which had the same permissions.

I navigated to the folder and run this next command.

chmod 777 *

This looked to have done the trick, but upon further investigation found that it had change all the folders and files permissions in the root of that directory, but not further down.

I finally found this following command to work.

chmod 777 * -R dirname

This is what is called a recursive chmod, which is what I was after.

List

When you want to list a directory you use the following command.

ls

This lists the directory.

ls | more

This is when the list is bigger than your screen, and it allows you to work your way through it.

ls -l

This will list in detail, including owner, date created and permissions.

ls -la

I recently had a problem when looking for a .htaccess file. Using the above command is 'List All', and showed my hidden file.

Changing Linux Date and Time

I had to learn to change the date on a Debian Linux machine recently and although it was pretty straight forward, it took me a while to find it on the web.

date

This displays the current date and time.

date --set 13:00

This sets the time to 1pm.

date --set 2008-01-16

This sets the date to the Sixteenth of January 2008.

If you want to do a bit more like set the time to auto sync or change timezones then visit this debian help page.

Ping

Ping in linux is simple, but the otherday I wanted to stop ping, otherwise it goes on for ages. The following command stops pinging.

CTRL + C

Using Vi

I always have problems using vi in Linux, I will display my own Vi tips here one day, but for now you will have to use this Vi Commands web site

Linux in Colour

Using the following command will show things like directories in colour.

alias ls=“ls --color=auto”

+
1 Comments   |   Permalink   |
Comment by: Peter
Tuesday 18th December 2007 at 11:54

Thanks, this really helped me alot.

Add your own comment

Use the form below to add a new comment to the blog entry and other comments above.

Visitor Name:
Visitor Comment:
Email Address:

Your email address will NOT be forwarded to any third parties.

 
Visual CAPTCHA
Captcha Image: