Hobo Chen

Intro to Linux for ACM Contestants

This post is the tutorial to someone who is first to Linux.

Though i think every acm contestant must have known linux more or less, but i did see somebody troubling with the linux programming environment, which is critical for those who will take part in ACM/ICPC onsite contests.

First you may Baidu or Google to find how to install a linux distribution on your own computer. I strongly recommend you to install as virtual machines by using Virtual Box or VMware. Also, Ubuntu is more friendly to new users though it has more possibility to crash.

Change Directory

commands about directory

1
2
3
4
ls # list the files in current directory, simply
ll -ah # list the files in current directory, with details
cd .. # return to upper directory
cd _hobo # enter the sub-directory named _hobo

Manipulate Files

command about files

1
2
3
4
5
6
7
8
9
10
11
rm _hobo # delete the file named _hobo, failed if _hobo is a folder name
rm -r _hobo # delete the folder named _hobo with all files in it, dangerous!
cp _hobo _eddie # copy the file named _hobo to a new file named _eddie
cp _hobo ../_eddie # copy the file named _hobo
# save to a new file named _eddie in upper folder
# "../" could be replaced by any path
# cp also works with "-r", means _hobo is a folder
mv _hobo _eddie # rename the file named _hobo to _eddie
mv _hobo ../_hobo # move _hobo to the uppder folder
mkdir _hobo # add a folder named _hobo
# in linux, folder is one kind of files

Compile and Run

command for c++ users

1
2
3
4
g++ _hobo.cpp # compile the file named _hobo.cpp
# then the name excutable file is "a.out"
./_hobo # run the excutable file named _hobo
./_hobo < in # run the excutable file named _hobo, with input named "in"

Shundown and Reboot

If there is something wrong, reboot; if there is still something wrong, format the disk then reinstall the system. – Oheb Cohn

manipulate the system

1
2
halt # shun down the system, need to be root
reboot # reboot the system, need to be root as well