Chapter 2 - Advanced Linux Commands



AD

Advanced Linux Commands

2.1 In Chapter 1 we covered basic commands, and file structure. In this Chapter we cover other useful commands.

2.2 The pipe symbol “|”combines commands.

2.3 The letters “grep” are used with the pipe symbol to find patterns.

2.3.1 The “ls | grep pattern” lists the directories or files in current directory that contain the pattern.

2.4 The tilde symbol “~” represents the home directory, or default directory. If you want to return to the home directory, type the tilde and press Enter. For example cd ~ will take to the home directory.

2.5 The word “less” allows you to view contents of files without making changes.

2.5.1 The “ls -al | less + /pattern” Allows you to search the current directory for a pattern in a filename or directory, and to scroll up or down with arrows. Use Ctrl + z to quit.

2.5.2 The “less filename + /pattern” Searches the file for the pattern. Allows you to scroll up and down with arrows to see all pattern matches. Use Ctrl + z to quit.

2.6.1 The “du | sort -n” sorts with largest directories in viewing window.

2.6.2 The “du | sort -nr | less” sorts with largest directories viewed in window. Allows you to scroll with up or down arrows. Use Ctrl + z to quit.

2.7 “df” shows the filesystem usage in percent.

2.8 “tail filename” Prints bottom10 lines

2.9 “head filename” Prints top 10 lines





theSurfDragon.com


Linux Navigation

Table of Contents
Ch1-Basic
Ch2-Advanced
Ch3-Downloading
Ch4-Screenshots