The command line makes our life so much easier since we can automate several mundane tasks and make things run smoother. Instead of clicking around in the Graphical User Interface (GUI), we can fire off a couple of commands and call it job done.

A Unix shell is a command-line interpreter or shell that provides a command-line user interface for Unix-like operating systems. The shell is both an interactive command language and a scripting language and is used by the operating system to control the execution of the system using shell scripts.

Every Linux or Mac-based operating system has a command-line installed by default, usually under the name “Terminal.” The command line (CLI) lets us easily move and rename files, sort through data, and navigate around the computer.

Without further ado, here are 5 command line tricks that will make your life easier.

 

    • grep :      $ grep “some string” file

The grep command searches for patterns in each file. It also looks for patterns separated by newline characters, and grep prints each line that matches a pattern.

 

    • ls :       $ ls

ls lists files and directories in the current active path. If the pathname is a file, ls displays information on the file according to the requested options. If the pathname is a directory, ls displays information on the files and subdirectories therein.

 

    • pwd :      $ pwd

The pwd command is a command-line utility for printing the current working directory. The output will print the full system path of the current working directory to standard output. By default, the pwd command ignores symlinks, although the full physical path of a current directory can be shown with an option.

 

    • echo :       echo “some text”

The echo command in Linux is used to display a line of text/string that’s passed as an argument. The echo is a built-in command that’s mostly used in shell scripts and batch files to output status text to the screen or a file.

 

    • touch :       $ touch somefile

The touch command is used to create a file without any content. The touch command can be used when the user doesn’t have data to store at the time of file creation.

Source : Here

Related Articles
Leave a Reply

Your email address will not be published. Required fields are marked *