Tag Archives: Linux

Ubuntu 10.04 Linux Commands Cheat Sheet

Unzip:

  • sudo apt-get install unzip
  • unzip [file]

Tar:

  • tar -cvvf foo.tar [directory]
  •  tar -zcvf {new file name}.tar.gz {directory to compress}

Untar:

  • tar -zxvf yourfile.tar
  • tar -xvfz filename.tar.gz
  • tar -xvzf filename.tar.gz [directory]
  • tar -jxvf filename.tar.bz2

Find: find [dir] -type d|f -iname ‘searchstring’

  • find / -type -d -iname ‘python’
  • find ~ -type d -exec chmod +x {} ;

Delete a user account

  • sudo deluser <username>

Add an New user

  • sudo useradd <username>

or

  • sudo useradd -d /home/<directory> -m <username>

( -d specifies home directory, -m makes the folder if it doesn’t exist )

useradd doesn’t add password unless you add -p     …. or you can just set the password later with:

  • sudo passwd <username>

If called with two non-option arguments (see below), adduser will add an existing user to an existing group.

Add an existing user to an existing group

  • sudo usermod -a -G <group> <user>

Set password of new user

  • sudo passwd <username>

Make a new Group: 

  • groupadd <groupname>

To see what groups currently exist:

  • cat /etc/group

To see current users logged in:

  • w

Count lines in file:

  • wc -l <filename>

 

Updating timezone information on my VPS

Haha because of having a VPS I cannot set the time on it, from what I can tell.  All though I cannot change the time, i can update the timezone.  This is a very easy to do command:

export TZ=America/Chicago

BAM! After running this command I run the command:  date   to make sure it worked.

Linux – User Commands (finding users registered in the system)

Find all users and services registered in the system:

cat /etc/passwd

Find all users registered in the system:

cat /etc/passwd | grep “/home”

To add a user to a group:

usermod -G<group> <user>

To delete a user and their home directory: (Users can have a “home” directory)

userdel -r <user>

Things i came across setting up VPS (servers) on linux.  In the midst of creating a domain i created users and webmin failed on me, and when i fixed the issue webmin failed on me again saying this user was already existed on the unix system.  Please feel free to comment.

Related Posts

Related Posts