Introduction to command line and accessing servers remotely
Marco Büchler, Emily Franzini, Greta Franzini, Maria Moritz
eTRAP Research Group Göttingen Centre for Digital Humanities Institute of Computer Science Georg August University Göttingen, Germany
DH Estonia 2015 - Text Reuse Hackathon
20. Oktober 2015
Who am I?
•
2001/2
2006
Head of Quality Assurance department in a software company
•••••••
Diploma in Computer Science on big scale co-occurrence analysis
2007- 2008 2011 2013 2014-
Consultant for several SMEs in IT sector Technical project management of eAQUA project PI and project manager of eTRACES project PhD in „Digital Humanities“ on Text Reuse Head of Early Career Research Group eTRAP at Göttingen Centre for Digital Humanities
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Agenda
1) Connecting to the server 2) Some command line introduction
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Connecting to the server
1) Windows: Start Putty 2) Mac + Linux: Open a terminal 3) Connecting to server via ssh -l <login> 192.168.11.4 4) Enter password
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Which folder am I on the server?
Command: pwd (parent working directory)
Usage: pwd <ENTER> Example: pwd <ENTER>
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Which files and directories are contained in my pwd?
Command: ls (list)
Usage: ls -l <FOLDER> <ENTER> // list all files and directory one on each line
ls -la <FOLDER> <ENTER> // show also hidden files ls -lh <FOLDER> <ENTER> // show e.g. files sizes in human-
friendly version
Example: ls -l <ENTER>
ls -lh /home/mbuechler <ENTER>
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to change a different directory?
Command: cd (change directory)
Usage: cd <FOLDER> <ENTER> // change to <folder> Example: cd ~ <ENTER> // change to „home folder“ cd /storage <ENTER>
- cd .. <ENTER>
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to create a folder?
Command: mkdir (make directory)
Usage: mkdir <FOLDER> <ENTER> // change to folder Example: mkdir /storage/mbuechler <ENTER> // creates a directory in /storage called mbuechler
mkdir /storage/mbuechler/test <ENTER>
// creates a directory in /storage/mbuechler called test
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to copy a file?
Command: cp (copy file)
Usage: cp <PATH_TO_FILE> <TARGET_FOLDER> <ENTER> Example: cp /storage/HelloWorld.jar /storage/mbuechler <ENTER> // copies HelloWorld.jar to /storage/mbuechler
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to remove a directory?
Command: rm (removes directory or file)
Usage: rm -r <PATH_TO_FILE_OR_FOLDER> <ENTER> Example: rm /storage/mbuechler/test <ENTER>
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to run a java programme?
Command: java (run a java programme)
Usage: java -Xmx1g -Dproperty=value -jar <programme> <ENTER>
Example: java -jar HelloWorld.jar
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to edit a file?
Command: vim (vi improved)
Usage: vim <file_name> <ENTER> Example: vim .bash_profile (use cd ~ first)
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
How to edit a file?
vim command:
1) Change to editor modus: type „i“ (insert) 2) Leave editor modus: press ESC-button 3) Leave vim without writing changes to disc: type „:q!“ 4) Leave vim with writing changes to disc: type „:wq“
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Edit the bash_profile
vim command:
1) Change to home folder: cd /home/mbuechler 2) Edit bash_profile: vim .bash_profile 3) Add two lines for adding the correct java version:
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015
Encoding guide
1) Most UTF-8 editors are able to display the encoding (e.g. on the bottom) 2) If you are not sure, which encoding your data is in or have troubles to display them properly in an editor AND the file is not too big, you can try to open it in your standard text processing program (e.g.Word) to find information on the encoding.
3) Windows: install Cygwin (https://cygwin.com/install.html)
4) After you made sure your .txt files are COPIED to your (cygwin) user directory:
$ file *.txt
5) Depending on the output, list all possible encodings:
$ iconv -l
6) And re-encode (e.g. Windows Hebrew to UTF-8):
$ iconv -f CP1255 -t UTF-8 in.txt > out.txt
- DH Estonia 2015 - Text Reuse Hackathon
- 20. Oktober 2015