How to download a file on the command line
You have many choices but two popular ones are curl
and wget
.
Example with curl:
$ curl <url> --output <output_file_name>
$ curl https://raw.githubusercontent.com/jonbcard/scrabble-bot/master/src/dictionary.txt --output dictionary.txt
Now you have a file at your current directory!
How to examine a file on the command line
Get the permissions and size of the file (ls -lh)
$ ls -lh dictionary.txt
Look through the file. (less)
- Use
j
andk
to navigate down and up. - Use
q
to quit
$ less dictionary.txt
Find the number of rows in the file (wc -l)
$ wc -l dictionary.txt
Get the first and last 10 rows of the file (head, tail)
$ head dictionary.txt
$ tail dictionary.txt
# default number of lines is 10 but can be changed
$ head -5 dictionary.txt
$ tail -7 dictionary.txt
Print every 10000 lines (sed)
$ sed -n '0~10000p' dictionary.txt
Search the file for text (cat, grep)
$ cat dictionary.txt| grep STAPEDE