Professional Documents
Culture Documents
Lutfi Rohman
7 September 2018
MODUL 2
Judul Praktikum:
Perintah-Perintah Dasar Linux, Instalasi C/C++, gfortran, Python dan Bahasan Pemrograman
Tujuan:
-Catat/rekam hasil yang diperoleh dari eksekusi perintah tersebut di komputer Anda
List:
cat
Melihat isi file tanpa harus membuka file, dan menuliskan isi file dalam layar terminal $ cat nama_file (enter)
cd
$ cd alamat_directory
pwd
clear
$ clear
cp
$ cp test.txt /home//himanshu/Desktop/
date
The date command can be used to print (or even set) the system date and time.
$ date
echo
$ echo hello hi
find
The find command lets you search for files in a directory as well as its sub-directories.
$ find test*
free
The free command displays the amount of free and used memory in the system.
$ free
gzip
The gzip command compresses the input file, replacing the file itself with one having a .gz extension.
$ gzip file1
gunzip
Files compressed with gzip command can be restored to their original form using the gunzip command.
$ gunzip file1.gz
history
The history command is used to display the history of commands that you typed in on the shell. It can be used to
record and replay commands too. To view the command history, run:
$ history
locate
$ locate [file-name]
ls
$ ls progress
lshw
The lshw command extracts and displays detailed information on the hardware configuration of the machine.
$ sudo lshw
lscpu
The lscpu command displays in output system's CPU architecture information (such as number of CPUs, threads,
cores, sockets, and more).
$ lscpu
mkdir
$ mkdir [dir-name]
mv
The mv command lets you either move a file from one directory to another, or rename it.
$ mv test.txt /home/himanshu/Desktop/
nano
The nano command in Linux launches the 'nano' editor. The editor is designed to emulate the features and
user-friendliness of the UW Pico text editor.
$ nano
nproc
The nproc command displays the number of processing units available to the current process.
$ nproc
passwd
The passwd command is used for changing passwords for user accounts.
$ passwd himanshu
ping
The ping command is used to check whether or not a system is up and responding. It sends ICMP ECHO_REQUEST
to network hosts.
$ ping howtoforge.com
pwd
$ pwd
$ rm [file-name]
rmdir
$ rmdir [dir-name]
shutdown
The shutdown command lets user shut the system in a safe way.
$ shutdown
size
The size command lists the section sizes as well as the total size for an object or archive file.
$ size test
watch
The watch command can be used to monitor a program's output. It runs the program repeatedly, displaying its
output and errors. For example:
$ watch date
wget
The wget command line tool in Linux lets you perform a non-interactive download of files from the Web.
wget [URL]
who
$ who
Jika sourcecode program dalam C/C++ atau fortran disimpan dalam file dengan nama misal X.cpp atau X.f90 maka
kompilasinya dapat dengan dua cara:
A. Dari terminal
https://www.physics.rutgers.edu/grad/509/
Progam kalkulator:
1.Petunjuk: ketikan script program ini di editor geany atau di text editor Anda:
int main(){
char op;
switch(op)
case '+':
break;
case '-':
break;
case '*':
break;
case '/':
break;
default:
break;
}
return 0;}
Tugas:
1. Buatlah program menghitung akar-akar persamaan kuadrat dalam bahasa C/C++ dari persamaan kuadrat:
ax2 +bx -c = 0
2. Buatlah laporan praktikum dari Modul 2 ini seperti format laporan sebelumnya