Basic Unix CommandsWhat is Unix Command?The below article gives an overview of Unix commands. An OS providing both command line interface (CLI) and graphical user interface (GUI) based interaction integrated by Dennis Ritchie, Douglas Mcllroy, Joe Ossanna Brian Kernighan, and Ken Thompson at Bell laboratory in 1970 called a multi-tasking operating system permitting two or more users to simultaneously operate on the operating system and offers commands for the users for interacting with the application from command line interface, such as sudo command, chmod command, su command, mv command, rm command, vi command, cat command, rmdir command, mkdir command, clear command, and ls command, which can be used to implement complex tasks. Introduction to UnixUnix is an OS that provides both CLI and GUI-based interaction. It was developed by Dennis Ritchie in the C language. Unix operating system is multitasking, which also gives an opportunity for two or more users to use its benefits. In other words, it is a multi-user OS. Ubuntu OS is a Unix version that enables us to do every work that Unix is supposed to do. Hence, it's recommended by professionals who operate with servers; it's also recommended to learn how the command-line-based operating system works. Many large and complex applications that utilize Unix to execute because of its aspect to handle the processes easily. It's a bit faster and provides a nice user experience when compared with the Windows operating system. Several testing activities, such as performance and installation testing, depending on OS knowledge. Almost every web server is Unix based nowadays. So, knowledge of Unix is essential for testers. If we are unfamiliar with Unix, then learning Unix commands can be a great start. One of the best ways to understand these commands is to practice and read them simultaneously on Unix OS. Basic Commands in Unix
Syntax: Examples: If we need to show the calendar for March 2018, we can use the following Unix command:
Syntax: Examples: If we need to show the date in dd/mm/yy format, we can use the following Unix command:
Syntax: Example: We can use the below command to print "Example" as a banner:
Syntax: Example: We can use the following command to list every user logged in currently:
Syntax: Example: We can use the following command to list the users logged in currently:
Syntax: Example: We can use the following command to make empty files:
Syntax: Example: We can use the following command to make a file along with entered content:
Syntax: Examples: We can use the following command to copy the contents of text1 and text2, and the contents of text1 are retained:
Syntax: Examples: We can use the following command to make empty files known as text1 and text2:
Syntax: Example: We can use the following command to delete text1:
Syntax: Example: We can use the following command to make a directory:
Syntax: Example: We can use the following command to make empty files:
Syntax: Example: We can use the following command to change our working directory:
Syntax: Example: We can use the following command to print "direct1" if our current working directory is "direct1": What is the Unix process?A program runs in a process. Each time when a program or command is run, a fresh process is established. The process is running for as long as the command is in an active state. For instance, if we are running the command, i.e., cat, the cat process is generated. The kernel assigns a special identification number known as the PID or process identification number, which ranges between 0 to 32,767 every time a fresh process is established. Other process properties include their GID (group related to the process), UIS (user id owns the process), TTY (controlling terminal through where they're launched), and PPID (the parent PID). A process has a hierarchical relationship in Unix, where a parent process generates the child process. The process, i.e., init, is the grandfathering process of every other process. In a few cases, the child is known as an orphan process. Process Types in Unix
Control CommandsThe control commands are a two-key combination in which a letter is simultaneously pressed using the 'Ctrl' key.
Other commands:
Syntax: Example, The above command will display all running processes formatted as a table.
Syntax: Example, The above command will display a live view of every current process.
Syntax: Example, The above command will continue executing a job that was suspended in the background previously.
Syntax: Example, The above command will bring a previous job to the foreground from the background.
Syntax: Example, The above command will clear every prior text through the terminal window.
Syntax: Example, The above command will display the list of old commands that were enrolled.
Syntax: Example, The above command will list every content of a directory in a long way sorted by time.
Syntax: Example, The above command will list every path from where 'cat' can execute.
Syntax: Example, The above command will display the manual page for 'cat'.
Syntax: Example, The above command will modify the specified user-id.
Syntax: Example, The above command will get the file listing of the unlisted directory.
Syntax: Example, The above command will search for character device files of the 'text' name in the '/usr' folder.
Syntax: Example, The above command will display the total blocks utilized by files within the current directory.
Syntax: Example, The above command will show the total free blocks inside the local file systems. Next TopicTypes of Linux Operating System |