49 lines
1005 B
Org Mode
49 lines
1005 B
Org Mode
|
* Display files
|
||
|
|
||
|
Show content of a file. Concatenates and writes file.
|
||
|
Using "tac" reverses the result of "cat" command
|
||
|
|
||
|
: cat file.txt
|
||
|
|
||
|
Using head, tail and less to show parts of files
|
||
|
|
||
|
Showing the first two entries
|
||
|
|
||
|
#+begin_src bash
|
||
|
head -n 2 /etc/hosts
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
| 127.0.0.1 | localhost |
|
||
|
| 127.0.1.1 | myuser |
|
||
|
|
||
|
Showing the last two entries
|
||
|
|
||
|
#+begin_src bash
|
||
|
tail -n 2 /etc/hosts
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
| ff02::1 | ip6-allnodes |
|
||
|
| ff02::2 | ip6-allrouters |
|
||
|
|
||
|
|
||
|
#+begin_src bash
|
||
|
less /etc/hosts
|
||
|
#+end_src
|
||
|
|
||
|
#+RESULTS:
|
||
|
| 127.0.0.1 | localhost | | |
|
||
|
| 127.0.1.1 | myuser | | |
|
||
|
| ::1 | localhost | ip6-localhost | ip6-loopback |
|
||
|
| ff02::1 | ip6-allnodes | | |
|
||
|
| ff02::2 | ip6-allrouters | | |
|
||
|
|
||
|
|
||
|
Show content of a zip file using less and pipe "|"
|
||
|
|
||
|
#+begin_src bash
|
||
|
unzip -l tntvillage_484094.zip | less
|
||
|
#+end_src
|
||
|
|