Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Skinning The Cat


  • Please log in to reply
1 reply to this topic

#1 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 31 January 2016 - 03:54 PM

You can also use "zless" to look at .gz files. No need to unzip them.

-REF:http://www.bleepingcomputer.com/forums/t/603527/core-dump-reports/#entry3920836
Thanks for posting that. I hadn't heard of zless before, and when I Googled it, I found several other z-tools that could come in quite handy.

Inspired by the above quote, I thought I'd start a thread where we can discuss and share different one-liner command/commandsets to accomplish the same task. This doesn't necessarily mean they produce identical outputs, it means they do the same thing.

Hopefully this thread can produce enjoyable discussions, and useful lists of commands.
 

Below is the post format I'm using for submissions. You don't need to use it. I just posted my formatting here so that it's easier for me in future, because I can copy/paste when making new submissions.

#. What Commands Do:
(Tested on OS NAME AND RELEASE on DATE)
[code]commands[/code]
Dependencies: program-name, program-name.
[code]commands[/code]
Dependencies: program-name (package-name), program-name.

(Note the use of "program-name (package-name)", because in this case the program is included in a package of a different name.)

 

 


1. View A Gzipped Text File In A Paged Read-Only Output:
(Tested on ElementaryOS 0.3 64bit on January 31 2016)

gzip -k -d -c /directory/file.gz | less

Dependencies: gzip, less.

gunzip -k -c /directory/file.gz | less

Dependencies: gzip, less.

zless /directory/file.gz

Dependencies: gzip.

gzip -k -d -c /directory/file.gz | pg

Dependencies pg (util-linux), gzip

gunzip -k -c /directory/file.gz | pg

Dependencies: gzip, less.

7z x -y -so /directory/file.gz 2>/dev/null | less

Dependencies: p7zip (p7zip-full), less.

7z x -y -so /directory/file.gz 2>/dev/null | pg

Dependencies: p7zip (p7zip-full), pg (util-linux).


Edited by hollowface, 31 January 2016 - 06:42 PM.


BC AdBot (Login to Remove)

 


#2 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 31 January 2016 - 06:43 PM

2. Output Text File Contents To Terminal:
(Tested on ElementaryOS 0.3 64bit on January 31 2016)

cat /directory/file
Dependencies: cat (coreutils)
grep -a "" /directory/file
Dependencies: grep
dd if=/directory/file status=none
Dependencies: dd (coreutils)
tac /directory/file | tac
Dependencies: tac (coreutils)
rev /directory/file | rev
Dependencies: rev (coreutils)
lines=$(wc -l /directory/file | sed 's/ .*//g') && head --lines="$lines" /directory/file
Dependencies:wc (coreutils), sed, head (coreutils)
lines=$(wc -l /directory/file | sed 's/ .*//g') && tail --lines="$lines" /directory/file
Dependencies:wc (coreutils), sed, tail (coreutils)
zcat -f /directory/file
Dependencies: gzip
gzip -c -d -k -f /directory/file
Dependencies: gzip
gunzip -c -k -f /directory/file
Dependencies: gzip




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users