728x90
linux cmd 쉘에서 json 파일 이쁘게 보기
화이트 스페이스(tab, space) 문자로 구분안되는 json 파일을 보기 쉽게 하기 위해, 웹을 이용한다거나 tool 을 설치를 할 수도 있겠지만 python 으로 간단하게 볼 수 있다.
# more repositories.json
{"Repositories":{"docker.io/centos":{"docker.io/centos:latest":"sha256:328edcd84f1bbf868bc88e4ae37afe421ef19be71890f59b4b2d8ba48414b84d","docker.io/centos@sha256:26f74cefad82967f97f3eeee
f88c1b6262f9b42bc96f2ad61d6f3fdf544759b8":"sha256:328edcd84f1bbf868bc88e4ae37afe421ef19be71890f59b4b2d8ba48414b84d"},"docker.io/hello-world":{"docker.io/hello-world:latest":"sha256:1815c
82652c03bfd8644afda26fb184f2ed891d921b20a0703b46768f9755c57","docker.io/hello-world@sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f":"sha256:1815c82652c03bfd8644a
fda26fb184f2ed891d921b20a0703b46768f9755c57"},"docker.io/stalk/xpush":{"docker.io/stalk/xpush:latest":"sha256:ac342894782de326090504c8bee7772e7bcf4530d6d26decfb94e051875d9394","docker.io
/stalk/xpush@sha256:b32ceb94e472e8d3634bdf370f4909d86d4fb8340b7de0c5b9761764d2fb0684":"sha256:ac342894782de326090504c8bee7772e7bcf4530d6d26decfb94e051875d9394"},"docker.io/ubuntu":{"dock
er.io/ubuntu:latest":"sha256:ccc7a11d65b1b5874b65adb4b2387034582d08d65ac1817ebc5fb9be1baa5f88","docker.io/ubuntu@sha256:34471448724419596ca4e890496d375801de21b0e67b81a77fd6155ce001edad":
"sha256:ccc7a11d65b1b5874b65adb4b2387034582d08d65ac1817ebc5fb9be1baa5f88"}}}
# more repositories.json | python -mjson.tool
{
"Repositories": {
"docker.io/centos": {
"docker.io/centos:latest": "sha256:328edcd84f1bbf868bc88e4ae37afe421ef19be71890f59b4b2d8ba48414b84d",
"docker.io/centos@sha256:26f74cefad82967f97f3eeeef88c1b6262f9b42bc96f2ad61d6f3fdf544759b8": "sha256:328edcd84f1bbf868bc88e4ae37afe421ef19be71890f59b4b2d8ba48414b84d"
},
"docker.io/hello-world": {
"docker.io/hello-world:latest": "sha256:1815c82652c03bfd8644afda26fb184f2ed891d921b20a0703b46768f9755c57",
"docker.io/hello-world@sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f": "sha256:1815c82652c03bfd8644afda26fb184f2ed891d921b20a0703b46768f9755c57"
},
"docker.io/stalk/xpush": {
"docker.io/stalk/xpush:latest": "sha256:ac342894782de326090504c8bee7772e7bcf4530d6d26decfb94e051875d9394",
"docker.io/stalk/xpush@sha256:b32ceb94e472e8d3634bdf370f4909d86d4fb8340b7de0c5b9761764d2fb0684": "sha256:ac342894782de326090504c8bee7772e7bcf4530d6d26decfb94e051875d9394"
},
"docker.io/ubuntu": {
"docker.io/ubuntu:latest": "sha256:ccc7a11d65b1b5874b65adb4b2387034582d08d65ac1817ebc5fb9be1baa5f88",
"docker.io/ubuntu@sha256:34471448724419596ca4e890496d375801de21b0e67b81a77fd6155ce001edad": "sha256:ccc7a11d65b1b5874b65adb4b2387034582d08d65ac1817ebc5fb9be1baa5f88"
}
}
}
- cat 이나 more 명령어로 json 파일을 열어서 파이프로 연결후, python 명령어 (python -mjson.tool)로 beautify 해서 출력.
도움받은 사이트:
'Engineering > Linux' 카테고리의 다른 글
ffmpeg install on CentOS (0) | 2017.10.19 |
---|---|
NodeJS 설치 on CentOS 7 (0) | 2017.09.12 |
virbr0 인터페이스 비활성화 on CentOS (0) | 2017.03.22 |
Timezone 변경 on CentOS 7 (0) | 2016.01.12 |
방화벽 설정 on CentOS 7 (0) | 2015.12.23 |