Archive

Posts Tagged ‘Linux-Generic’

How to copy entire folder in Linux?

December 12th, 2008 No comments

Here’s another simple command for novice linux user

Copy entire folder (including content) to another location

cp -R

Example:

cp -R /home/myid/myfolder /var/www/newfolder

This will copy myfolder to newfolder. In another word, content inside myfolder will be now in newfolder

Categories: FAQ & Tip

How do I delete none-empty folder in Linux?

December 10th, 2008 No comments

The command you should use is

rm -r

Example

rm -r /var/mydir

This will remove “mydir” folder, if there’s content it will be recursively deleting them all.

Categories: FAQ & Tip

How to set Path in Linux?

April 26th, 2008 No comments

PATH is a System Environment Variable which you can find most of the important commands/values that are available to user.

The syntax for setting your path can be slightly different dependent on which shell you are using.

Note: Use finger command to find out which shell you are using

$ finger manet
Login: manet                            Name: Manet Yim
Directory: /home/manet                  Shell: /bin/bash

Set path

On bash shell

export PATH=$PATH:/usr/sbin/:/usr/local/bin

On tcsh or csh shell

set PATH = ($PATH /usr/sbin /usr/local/bin)

These settings can be added to your profile file so it will be available every time you login.

.bashrc on bash shell or .cshrc on csh or tcsh shell.

Categories: FAQ & Tip

Allow more sudoers

November 2nd, 2007 No comments

If you ever need more sudoer in your system or group, follow a few steps below

On command line, type

EDITOR=gedit sudo visudo

Append the following line at the end of file

system_username ALL=(ALL) ALL

If you don’t prefer the above step, you can add user to to admin group which has permission to use sudo. User the following command to add user to admin group.

sudo adduser a_username admin

This appends the admin group to the user’s supplementary group list. They will now have sudo access.

Categories: FAQ & Tip

Restore GRUB menu after Windows installation

November 2nd, 2007 No comments

[ This post is duplicated to updated version at 2008/06/06/restore-grub-after-installing-windows ]

From my experience, when I format my Windows I lost my Grub boot menu at the same time. Before I have this solution, I usually reinstall everything all over again. Now that I want to keep things running for a long term, even my windows need to be formatted I still have my Linux OS bootable without losing anything. Below is the solution.

If you have similar scenario follow the rest of this post, I will show you trick and tools will be the solution for you

Tool

  • Linux Live CD

Restore Grub

Read more…

Categories: FAQ & Tip

How to set global variable in Linux?

September 4th, 2007 No comments

When you create a global variable, you are making it available system wide (for all users). It is an alias of a certain command or directory which/where it should be available and can be access from anywhere in the system. For example, you are installing Java Development Kit manually and javac command need to be accessed from anywhere, then you create a variable for java home directory and the alias to javac command.

eg.

alias $JAVA_HOME=/usr/shared/jdk1.5
alias javac=$JAVA_HOME/bin/javac

Below is how to setup the global variables in linux. I am using Ubuntu Server 7.04 at the time I post this walk-through instruction.

The file /ect/profile is a system-wide profile for Bourne shell it’s also compatible with bash, ksh, ash. Edit this file to add your new environment variables.

  • type: sudo vi /etc/profile
  • Enter root password if prompted
  • Add the following lines
    export VARIABLE_NAME=path_to_your_destination
  • Repeat this line until you finish adding your variables
  • Exit current shell window and re-open (not reboot the machine)
  • type: env to list all environment variables that available to your current login,
  • You should see VARIABLE_NAME=path_to_your_destination

To test it

  • type: cd $VARIABLE_NAME
  • It should change current directory to path_to_your_destination
Categories: FAQ & Tip