Slackware linux - basics
Window manager: most common choice is KDE (version 3.x installed)
• Control center: use to adjust things
• Menu editor: change the menu items
• konqueror
• Corresponds to windows explorer
• Supports fish protocol for ssh to open directory from another computer
• right-click desktop: create new ⇒Link to URL
• add your username before word louhi (
[email protected])
• An icon appears on desktop ⇒double-click to open location
• kwrite/kedit/kate: text editing
• emacs might be worth studying, emacs -nw in terminal
• kalarm/korganizer: alarm clock and calendar
• kpdf: fast pdf-viewer
• acroread is more versatile
• konsole: kde terminal
• amarok: music player (very nice)
Sami Paavilainen Linux system at TUT physics department
Basic console commands and syntax
Command Description Examples
man Show manual page of a command man ls
ls Show directory listing ls -la; ls /usr/local/vasp/
cd Change work directory cd /usr/; cd examples
pwd Displays current work directory pwd
mkdir Create directory mkdir test
more/less View a file one page at a time; “q” to quit less file1
arrows or page up/down for more;“h” for help
emacs Text editor emacs file
cp Copy files and directories (-r option) cp file1 file2
cp -r examples /home/user/
rm remove a file rm file1
Options: -r for directory;-f no questions rm -r directory1
mv Move file (another place or rename) mv file1 file2
mv file1 /home/user/
logout Logs user out of the system
gzip/gunzip Compress/decompress files gzip file1
gunzip file1.gz
jobs Lists jobs which are running
kill Kills a job which is running kill %1
top Display system usage information; “q” to exit
nohup run a command immune to hangups nohup vasp > vasp.out &
Syntax examples:
command > outputfile command writes its output to file “outputfile”
command >> outputfile command adds its output to the end of file “outputfile”
command & command runs on background; user can input more commands on terminal
ls -la | less output of “ls” is piped to “less”for viewing one page at a time
Sami Paavilainen Linux system at TUT physics department
Bash - terminal command interpreter
• Previous commands are interpreted by SHELL (bash)
• Configuration of bash:
.bash profile: contains configuration information
export PS1=’\A \h > ’ # This tells you how prompt looks like
bind ’"\e[A":history-search-backward’ #matlab-like up and down keys
bind ’"\e[B":history-search-forward’
export PYTHONPATH=.:/home/paavi/Python/Packages/:/home/paavi/Python/Packages/VASP/
export PATH=˜/bin:/local/paavi/XVASP/Bin:$PATH:˜/Python/Packages/Tools:˜/bin/lhkaskyt:˜/.local/bin/
# a list of aliases
alias l=’less’
alias md=’mkdir’
alias ssh=’ssh -A’
alias wd=’echo ‘pwd‘ | sed "s/\/home\/paavi/˜/g"’
alias sshlouhi=’ssh -t louhi "cd ‘wd‘; bash"’
alias spotify=’wine .wine/drive_c/Program\ Files/Spotify/spotify.exe 2>&1 1> /dev/null &’
#functions
function la () {
ls -Falh $* | less -eXF
}
scpmurska () {
todir=‘wd‘
eval ‘printf "ssh murska ’[ -d %s ] || mkdir -pv %s’" $todir $todir‘
scp $* murska:$todir
}
Environment variables
• Set using export VAR=value
• HOME: home directory
• PATH: where programs will be searched in
• HOSTNAME: your computer name
• Check using env command
Sami Paavilainen Linux system at TUT physics department
Other stuff about system
Useful text handling commands
• cat/tac: show file in normal way/lines reversed
• grep: find a line with certain string from a file
• cut: cut certain parts of line from a file
• tail, head: show last/first lines of a file
• sed: stream editor, does many things, for example replaces strings
• awk: very versatile stream editor
• wc, sort, split,expand, tr, paste, join, ....
Other stuff
• jobs/ps: show information on terminal/all processes
• chmod: changes file permissions
• ln: create shortcut (link)
• kill: kill a process
• bc: simple calculator
• passwd: change your linux password
Mounting devices
1 Plug device (stick)
2 Write: mount /mnt/stick
3 Copy, read, etc to /mnt/stick/
4 Check that nothing is open at /mnt/stick/ (cd $HOME)
5 write: umount /mnt/stick
6 Unplug device (stick)
• Or create shortcut on KDE desktop (create new link to device)
• Right click icon to mount
• Check /etc/fstab for information
Sami Paavilainen Linux system at TUT physics department
SSH and SCP
Basic syntax
• ssh [email protected]
• scp file [email protected]:destdir
• scp [email protected]:sourcedir/sourcefile file
Making things easier:
$HOME/.ssh/config
Host murska
HostName murska.csc.fi
User paavi
• Now I can just write ssh murska instead of ssh [email protected]
Sami Paavilainen Linux system at TUT physics department
SSH and SCP without giving password all the time
1 ssh-keygen -t dsa
• Creates files id dsa.pub and id dsa in .ssh directory
• Give a strong password you can easily remember (ssh password)
2 Copy public key into remote computer
• Login on remote computer with ssh
• Create $HOME/.ssh directory (if not exist already)
• Edit authorized keys file (remote)
• Copy-paste contents of your local id dsa.pub into remote authorized keys file
• check that there is only single long line
• Log out
3 Make a file $HOME/.xsession in your home directory (local computer)
$HOME/.xsession
exec ssh-agent /usr/bin/startkde
4 Give it exec rights: chmod u+x $HOME/.xsession
5 Restart KDE
• Logout from KDE
• Choose “Custom” from the login menu
6 Open konsole and write ssh-add (asks for your ssh password)
7 Now you can login on remote computer without giving password
8 If you login by ssh -A you will also get back without giving password
• Handy with scp
Sami Paavilainen Linux system at TUT physics department
Other programs etc
Image processing
• xfig: graphs
• gimp: a versatile tool for image editing
• xv: view an image file
• ghostview,gv: view ps and eps files
• ImageMagic package: command line tools for image manipulation
• display: view image files
• convert: converts file format into another
• montage: compiles several images into one
• mogrify, animate, ... check man ImageMagic
Movies
• mplayer/vlc: watch movies
• menconder: change video format
• ppmtompeg: make an mpeg movie from series of images
Openoffice
• presentations, text documents, spreadsheets, image drawing...
• soffice file
Printing
• lpr file.ps
• kprinter
• Choose “duplex on” from the menu to get two-sided documents
A
LTEX
• Very nice way of producing documents (and presentations)
• Needs practise (works like a programming language)
Backups
• Done automatically every night
• Do not shut down your computer
Sami Paavilainen Linux system at TUT physics department
Analysis and compiling stuff
Matlab
• not on every computer, ask if needed
Octave
• free matlab clone, installed on every computer
Compiling programs
• Intel software
• ifort: fortran compiler
• icc: c++ compiler
• use -xP option on local computers
• MKL libraries (on some computers)
• Gnu programs
• gcc: c++ compiler
• gfortran: fortran compiler
• use -O2 -march=i686 on local computers
Plenty of other software not mentioned here
Also other programs can be installed if needed
• Contact Petri or Sami
Sami Paavilainen Linux system at TUT physics department