Try this using Chrome or Firefox. Microsoft browsers do not work well
Please open the page http://rstudio.iu.edu.tr:4200/
If it works, you will connect to the server from the browser
October 10, 2019
Try this using Chrome or Firefox. Microsoft browsers do not work well
Please open the page http://rstudio.iu.edu.tr:4200/
If it works, you will connect to the server from the browser
To be sure that nobody else uses your account
change the password I gave you for a good password
There is an online app for generating passwords
If you do not trust this app, you can download the code and modify it
The command to change your password is
passwd
You need to write the old password once, and the new passwords twice
less
Using less
, you can search though a text file for a keyword (pattern).
For example, to search through science.txt
for the word 'science', type
$ less science.txt
then, still inside less
, type a /
(forward slash) followed by the word to search
/science
As you can see, less
finds and highlights the keyword. Type n
to search for the next occurrence of the word.
grep
grep
searches files for specified words or patterns. Type
$ grep 'science' science.txt
As you can see, grep
has printed out each line containing the word science.
Is this all?
Try typing
$ grep 'Science' science.txt
The grep
command is case sensitive; it distinguishes between Science and science.
To ignore upper/lower case distinctions, use the -i
option. Type
$ grep -i 'science' science.txt
To search for a phrase or pattern, you must enclose it in single quotes
(this symbol: '
)
For example to search for spinning top, type
$ grep -i 'spinning top' science.txt
-v
display those lines that do NOT match-n
precede each matching line with the line number-c
print only the total count of matched lines
Try some of them and see the different results
For example, the number of lines without the words science or Science is
$ grep -ivc science science.txt
wc
(word count)A handy little utility is the wc
command, short for word count. To do a word count on science.txt, type
$ wc -w science.txt
To find out how many lines the file has, type
$ wc -l science.txt
Command | Meaning |
---|---|
grep 'keyword' file |
search a file for keywords |
wc file |
count number of lines/words/characters in file |
We have already seen one use of the cat
command to write the contents of a file to the screen.
Now type cat
without specifying a file to read
$ cat
Then type a few words on the keyboard and press the [Return] key.
Finally hold the [Ctrl] key down and press d
(written as ^D
for short) to end the input.
If you run the cat
command without specifying a file to read, it reads the standard input (the keyboard), and on receiving the ‘end of file’ (^D), copies it to the standard output (the screen).
In UNIX, we can redirect both the input and the output of commands.
We use the >
symbol to redirect the output of a command. For example, to create a file called list1
containing a list of fruit, type
$ cat > list1
Then type in the names of some fruit. Press [Return] after each one.
pear banana apple ^D
(this means press [Ctrl] and [d] to stop)
The cat
command reads the standard input (the keyboard) and the >
redirects the output, which normally goes to the screen, into a file called list1
To read the contents of the file, type
$ cat list1
Using this method, create another file called list2
containing the following fruit:
orange plum mango grapefruit
Read the contents of list2
The code >>
appends standard output to a file. So to add more items to the file list1
, type
$ cat >> list1
Then type in the names of more fruit
peach grape orange ^D
(Ctrl-D to stop)
To read the contents of the file, type
$ cat list1
You should now have two files. One contains six fruit, the other contains four fruit.
Command | Meaning |
---|---|
command > file |
redirect standard output to a file |
command >> file |
append standard output to a file |
who |
list users currently logged in |
This class is a derived work from http://www.ee.surrey.ac.uk/Teaching/Unix/
M.Stonebank@surrey.ac.uk, © 9th October 2000
Licensed under a Creative Commons License