Posts Tagged 'Linux'

Ubuntu setup

우분투 리눅스는 리눅스에 익숙하지 않은 일반 사용자라도 사용하기 쉽게 만들어 놓은 리눅스 배포판입니다. 데스크탑에서는 페도라를 사용하지만, 우분투를 노트북에 설치할 경우 윈도우와 듀얼부팅도 쉽게 할 수 있고, 무선랜 등 많은 설정들을 자동으로 해주기 때문에 노트북에 설치하였습니다. 우분투에서는 프로그램 개발에 필요한 소프트웨어들이 기본적으로 설치되지 않기 때문에 이러한 프로그램들은 따로 설치해주어야 합니다.

 

* Basic Compilers (c, fortran)

sudo apt-get install gcc

sudo apt-get install build-essential

sudo apt-get install g++

sudo apt-get install gfortran

 

* Basic programs

sudo apt-get install gnuplot

sudo apt-get install scons

sudo apt-get install mercurial

sudo apt-get install ruby

 

* Seismic Un*x

(sudo apt-get install xt)

sudo apt-get install libxt-dev  => for xtinstall

=> install Seismic Un*x

 

* Intel fortran compiler

sudo apt-get install rpm

sudo apt-get install libstdc++5

sudo apt-get install ia32-libs  => for 64bit machines

=> install Intel fortran compiler

 

*mpich2

mpich2를 설치할 때에는 sudo 명령을 사용해야 합니다.

sudo ./configure –prefix=…

sudo make

sudo make install

Adding a new hard disk to Linux

1. 리눅스에서 하드 추가하는 법

컴퓨터를 끄고 하드를 추가하고 bios에서 하드가 인식되는 것을 확인한 후 부팅합니다. Root 계정으로 로그인한 후,
# /sbin/fdisk -l
로 새 하드가 추가된 것을 확인합니다(예 /dev/sdc).
# /sbin/fdisk
를 실행하여 추가된 하드 디스크에 새로운 partition을 만듭니다. 새 파티션을 만드는 명령은 ‘n’이고 새 파티션을 쓰는 명령은 ‘w’입니다.
# /sbin/mkfs.ext3 /dev/sdc
로 새 파티션을 포맷합니다.
# mkdir /u1
과 같이 새 하드디스크를 마운트할 directory를 만듭니다.
# mount -t ext3 /dev/sdc1 /u1
과 같이 마운트합니다.
/etc/fstab 파일에
/dev/sdc1               /u1           ext3    defaults        1 2
과 같이 추가해줍니다. 끝.

2. 리눅스에서 네트워크 하드 디스크를 마운트하는 법

node01에 위의 하드를 추가했을 때, 위의 하드를 node02에도 마운트하는 법은 다음과 같습니다.
node01에서 /etc/exports 파일에 다음과 같이 추가해줍니다.
/u1     *(rw,no_root_squash)
여기서 *은 허용하는 ip 주소입니다. 그리고
# /usr/sbin/exportfs
# /etc/init.d/nfs restart
를 실행합니다.
다음에는 node02로 가서(rsh)
# mount -t nfs -o nolock node01:/u1 /u1
을 실행합니다. 끝.

참고할만한 파일들
/etc/fstab
/etc/mtab
/proc/mount

Useful shell shortcuts

Reference

Reuse previous arguments

The ! operator gives you a quick way to refer to parts of the previous command.

!! (Full contents of previous command)

How many times have you tried to edit a file, then realize that you need to be root to do it? Use bang-bang to quickly repeat the previous command, with other commands before or after.
emacs /etc/init.d/mongrel_cluster
=> Permission Denied
sudo !!
=> Now opens the file as root

!$ (Last arg of previous command)

Sometimes I need to reuse the last argument with another command, like here where I forgot to quote a string.
wget http://weather.yahooapis.com/forecastrss?p=98117
=> wget: No Match
wget '!$'
=> Now it works

!^ (First argument of previous command)

I rarely use this, although it could have been used in the previous tip.
echo fish and chips
echo !^
=> fish # First argument

!:1 (Argument by number)

!:1 is the same as !^. The difference is that you can reference any element of the previous command.

echo fish and chips
=> fish and chips
echo !:1
=> fish # Same thing as !^

echo fish and chips
echo !:2
=> and # Word 2 in previous command, zero-indexed

echo fish and chips
echo !:0
=> echo # The very first word in the previous command

echo fish and chips
echo !:1-3
=> fish and chips # A range

!pattern (Repeat last command in history with pattern)

The bang is useful for re-running a command that you’ve run before. Spell out the first few letters and hit ENTER (or TAB to show the completion in tcsh). The shell will search backwards in your history until it finds a command that starts with the same letters.

I like the tcsh behavior since you can hit TAB to see what you’re asking for. Using this in bash can be more adventurous since you don’t know what command will be run until you hit ENTER.
rake test:recent
...
!rak
=> Runs 'rake test:recent' or last command starting with 'rak'

Sets

{a,b} (A set)

How often do you rename just part of a file? The {} syntax is convenient.

mv file.{txt,xml}
=> Expands to 'mv file.txt file.xml'

mv file{,.orig}
=> Expands to 'mv file file.orig'

mkdir foo{1,2,3}
=> Expands to 'mkdir foo1 foo2 foo3'

다음 페이지 »



팔로우

Get every new post delivered to your Inbox.

Join 39 other followers