Linux 命令行学习之路 -- 11. 用 less 命令来显示文本文件 (display txt-file with more operations)

版权声明:本文为博主原创文章,未经博主允许不得转载。https://blog.youkuaiyun.com/qq_38812171


1. 定义 :less 命令是对 more 和 cat 的扩展,这就是所谓的 less is more。less 除了含有 more 的所有功能之外,还包括前后翻动和一些先进的搜索功能。

2. 参数预览:

                

 

          

 

     

3. 主要用法:

  3.1 上下键按行查看: pg up / pg dn

   3.2 /you 查找 单词 "you" 

03-08
### Command Prompt Usage and Operations The command-line interface (CLI), often referred to as the command prompt on Windows systems, provides powerful tools for executing commands directly from text input. For users familiar with this environment, performing tasks can become more efficient than using graphical interfaces. #### Basic Navigation Commands To navigate through directories within the command prompt: ```batch cd \path\to\directory :: Change directory. dir :: List files and subdirectories in current location. ``` These basic navigation commands allow manipulation of the filesystem without requiring mouse interactions[^2]. #### File Management Managing files via the command line includes creating, copying, moving, renaming, and deleting them: ```batch copy sourcefile destinationfile :: Copy a file. move oldfilename newfilename :: Move or rename a file. del filename :: Delete a specific file. echo content > newfile.txt :: Create a new file containing some initial text. ``` Each operation offers flexibility when handling multiple items at once by specifying wildcards (`*`) instead of individual filenames. #### Environment Variables Environment variables store information about the shell session which applications use during execution. Viewing these settings helps troubleshoot issues related to software configuration: ```batch set :: Display all environment variables currently set. set variable=value :: Set an environment variable temporarily for the duration of the session. ``` Understanding how to manage environment variables is crucial for developers working across different platforms since many build processes rely heavily upon correctly configured environments[^1]. #### Scripting Basics Batch scripting allows automation of repetitive tasks into reusable scripts written in `.bat` format. A simple example demonstrating conditional logic based on user input could look like this: ```batch @ECHO OFF SET /P answer=Do you want to continue? Y/N: IF "%answer%"=="Y" ( ECHO Proceeding... ) ELSE ( ECHO Operation cancelled. ) PAUSE ``` This script prompts the user before proceeding further, showcasing one way batch files enhance productivity while interacting less frequently with GUI elements.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值