[Bash] View Files and Folders in Bash

admin2024-08-22  11

Sometimes when working at the command line, it can be handy to view a file’s contents right in the terminal, or open a file with a certain application. We’ll learn how to view files in the terminal using cat and less and we’ll learn how to open them with open.

 

View Files:

A good command to view file:

$ less package.json

It shows only the files content without previous commands, and we can use keyboard to control the content display.

 

To bottom:

$ Shift + g

To top:

$ g

 

It also enable search content inside file easily:

/mdx

Search for "mdx" inside the file

[Bash] View Files and Folders in Bash,[Bash] View Files and Folders in Bash_ide,第1张

 

 

View Folder:

Sometime when you 'cd' into a folder by using command line, you also want to open the folder to see the files:

open .

It will opens the folder in current path.

 

You can also use 'open' to open a file by using default IDE:

open package.json

 

You can also open the folder by telling to using "Webstorm":

open . -a webstorm

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!