TOP-15 UNIX commands for Every Developer - ByteScout
  • Home
  • /
  • Blog
  • /
  • TOP-15 UNIX commands for Every Developer

TOP-15 UNIX commands for Every Developer

The current world is running on computers. Knowing simple Unix commands or basic Unix commands enable you to dive in the world of Unix or Linux system. It also allows confirming current system state and control files or directories. Here is the list of Unix command line basics for beginners.

Once the Unix startup is concluded, it will display a login window for the user to insert username and password. If the username and password are valid, then the Unix system will begin a login session. After this, the user can initiate a screen that operates a shell application.
Here’s an extensive Unix commands list you should know:

  1. Cal.
  2. Banner.
  3. Whoami.
  4. Ls command.
  5. Cat command.
  6. Rm command.
  7. Cp command.
  8. Pico command.
  9. Finger command.
  10. Lynx command.
  11. Man command.
  12. Pmap command.
  13. Touch Command.
  14. Grep command.
  15. Shutdown command.

1. Cal

The cal command is one of the most important Unix commands. This command is used to display the calendar of the entered value. By default, cal command displays the current month calendar as a result. cal is a conventional and one of the most basic of all the Unix commands. It displays an ASCII calendar of the assigned month or year.

Example: The following command will display the calendar for July 2019.

$ cal 7 2019

2. Banner

The banner command is one of the common Unix commands. This command displays a large ASCII description variant of the text that is given to it as its application arguments. In other words, this command displays a large banner on the conventional output window.

Syntax: banner message

Example: Print “Hello World” as the banner

$ banner Unix

3. Whoami

If you want to learn Unix commands then you must know all the basic commands first. The whoami command is an important part of the UNIX command line tutorial. This command displays the username/userid of the currently logged in user. This command is found in many Unix like operating system. It is also available in windows operating system.

Syntax: whoami [option]

Example: Diaply currently logged in user

$ whoami

The above command will display the current logged in user.

4. Ls command

The ls the Unix command to list directories. If you want to view the list of files on the computer system then the ‘ls’ command is used. This is one of the most important Unix commands. It displays the files /directories present in the current directory. It also supports many options. For example, if you want to display hidden files then ls command is used with the -a parameter.

For example

 $ ls -a

The above command will display all the hidden files present in the computer system.

5. Cat command

The cat is the Unix command to create a directory. In other words, the ‘cat’ command is applied to present text files. The great thing about this command is that it can also be utilized for copying, merging and creating new files. The cat is also known as concatenating command. It is one of the most regularly used commands in Unix. It is one all singing all dancing command because it allows to create single or many files, view check file, concatenate and redirect result in terminal or files.

Example: The following command is creating a new file test1 by using the cat command.

$ cat test1

6. Rm command

In UNIX, rm is a primary command used to remove things such as files, lists and typical links from file systems and also specific files such as machine nodes, channels, and devices, just like the del command in MS-DOS. This command is one of the most important commands of the UNIX commands cheat sheet.

Syntax: rm filename

Example: rm test1

The above example is displaying the removal of the file named test1. rm eliminates each defined file. By default, it does not eliminate lists. If the -I or — the interactive=once alternative is provided, and the options -r, -R, or –recursive are mentioned, then rm hints the user for whether to continue with the whole process.

7. Cp command

The cp command is the Unix command to copy directory. This is one of the most used UNIX commands. It copies any txt file to the directory. The only condition is that files should not exist already in the directory or are more latest than the files currently present in the directory. The alternative “-‐u” indicates “update,”

Syntax: cp filename.txt

Example:  cp test11.txt

8. Pico command

Pico is a part of a Pine command. This is one of the advanced Unix commands. This command begins an uncomplicated but powerful textbase mail application. Pine enables you to obtain, create, transmit and secure e-mail communications, communicating with anyone who is connected to the World Wide Web.

Syntax:  pico -w nameoffile

To produce a file named "test" with pico type:

Example: pico -w test

Messages written in Pine are published utilizing a file editor application named “pico”.The pico can also be applied from the UNIX to build and publish other files. By default, pico splits long lines between words, which provides a more normal display in most mail-reading applications.

9. Finger command

The finger command is one important command of Unix commands cheat sheet. It is utilized to show details about users on UNIX systems. Finger reveals a particular user’s complete name, last login, and when the user saw their mail. If you wanted to obtain details about a particular user, you would enter finger user_name. If you wanted to find a particular user on the Internet, just type finger username@host. You can also improve the performance of the finger by adding choices to the finger command. For example, if you have someone’s full user ID, then enter finger -m username, which is much faster than the regular finger command.

Syntax:

finger [-mlsqibfwhp] [username]

Example: finger jeff@abc.edu

10. Lynx command

Lynx is actually a web browser available on the Unix system. Lynx is a text-only browser interface and it is one of the advanced Unix commands. Lynx can be very helpful if the user wants quick access to valuable information, or wants to use a text-based terminal.

To initialize Lynx user has to just type lynx in any Unix session. By default, Lynx will begin showing the information. If you want to have lynx browse a particular page once it begins, then just type:

Syntax: lynx URL

Example: lynx www.abc.com

11. Man command

If you want to learn Unix commands then the man command is one of the important Unix commands. The man command will show the manual pages for most UNIX commands. If you want more information on any of the Unix commands then you can use the man command to see if there is an online page available. For instance, if you need assistance on the move (mv) command, you would enter:

man mv

Syntax: man command name

12. Pmap command

The Unix pmap command shows the process of memory usage or various processes. Pmap displays information about memory usage map or the address space. Memory is the most important component of the operating system and pmap is the most important Unix command. You just have to mention process id in order to find out the memory usage of the processes. In the result, it shows full address, kbytes, mode, and mapping.

Syntax: pmap options

Example:  pmap PID

13. Touch Command

Touch command is a command-line tool which is applied to update timestamps on files. UNIX operating system stores timestamp data of each file or directory including access time, update time and change time. It can be used to alter timestamps by using the touch command either to update timestamp to the latest time or to alter it to a date in the past.

Syntax:  touch -a filename

Example: touch -a test11

The above command sets the current time and date on a file test11. -a is the option which can be used

14. Grep command

The grep is one of the most advanced Unix commands. This command is used to search for a given string in a specific file. For example, if you have a file test11.txt. It contains an article of 1000 words. Now, if you want to search a particular text from this file then grep command can be used.

Syntax: grep -i filename

Example:  grep -i “Jeff” test11.text

The above command will search for the string Jeff in the file test11.txt. Grep is a command-line tool for finding plain-text data that match a regular expression. In other words, this command filter searches a specific file for a specific pattern of characters.

15. Shutdown command

The shutdown command is an administrator-level command. This command as the name suggests is used to shut down the system and turn the power off instantly. If you want to shut down your system immediately then you can use now option and if you want to shut down your system after 15 min then it can be done by adding +15 min as an extension.
Example
shutdown -h now

The above command is used to shut down the system immediately. Now, if you want to reboot it then it can be done by using -r option.

Example: Shutdown after 15 min

shutdown -h +15

Example of rebooting the system

shutdown -r now

At this point, our UNIX commands tutorial is quite extensive for beginners or advanced developers. We’ll get back with more commands and examples.

Learn to code with our Free Courses for everyone!

 

About the Author

ByteScout Author

Prasanna Peshkar

Prasanna is an independent cybersecurity consultant and technical writer, focusing on penetration testing and vulnerability assessment. He provides penetration testing services to a wide variety of clients, including financial institutions, brokerage firms, professional regulators, manufacturing companies and transportation companies.

 

prev
next