The semctl system call and its working has been demonstrated clearly in this guide with C language using Ubuntu 20.04 Linux system. We hope you will find this article helpful while understanding and learning the concepts of semaphores in the Linux system.
mv Command Examples
Below is the basic mv command examples on Linux terminal.
#linux commands #command #mv #useful example #mv command #linux
Dig Command Line Options and Examples
Here is the frequently used command line options and example’s of dig command.
1. Basic Dig Command
A basic dig command accept domain name as command line parameter and prints Address record.
2. Query With Specific DNS Server
The default dig command queries to dns server configured on your system. For example, the Linux systems keep default DNS entry in /etc/resolv.conf.
3. Print Short Answer
Use +short command line option to print result in short form. This is basically useful with the shell scripting and other automation tasks.
4. Print Detailed but Specific Result
Use +noall with +answer to print detailed information but specific. This will print only answer section including few more details as a result.
#linux commands #command #dig #dig command #useful examples #linux
GPM (“General Purpose Mouse”) software provides support for mouse devices in Linux virtual consoles. This package provides a daemon that captures mouse events when the system console is active and delivers events to applications through a library. By default, the daemon provides a ‘selection’ mode, in order that cut-and-paste with the mouse works on the console even as it does under X. It is used to select the text, drag the mouse while holding the left button, or to paste text within the same or another console, press the center button. The right button is employed to increase the choice. Two-button mice use the right button to paste the text.
It is included in most Linux distributions, but in case it is not, then run this command to install gpm.
sudo apt-get install gpm
sudo gpm [options]
#linux-unix #linux-command #linux-system-commands #picked
In this remove or delete directories and files linux tutorial guide, you will learn how to remove empty directory and non empty directory linux using command line. And as well as how to remove/file files linux using command line.
So, this tutorial guide will show you you how to use the
rmdir commands to remove or delete files and directories in Linux with and without confirmation.
#how to delete directory in linux #how to remove non empty directory in linux #remove all files in a directory linux #linux delete all files in current directory #linux delete all files in a directory recursively #delete all files in a directory linux
This guide takes a tour of some of the best command-line tools that are used for searching matching strings or patterns in text files. These tools are usually used alongside regular expressions – shortened as REGEX – which are unique strings for describing a search pattern.
Without much further ado, let’s dive in.
Coming in the first place is the grep utility tool – is an acronym for Global Regular Expression Print, is a powerful command-line tool that comes in handy when searching for a specific string or a pattern in a file.
Grep ships with modern Linux distributions by default and gives you the flexibility to return various search results. With grep, you can perform a vast array of functioning such as:
The syntax for using the grep command is quite simple:
$ grep pattern FILE
For example, to search for the string ‘Linux‘ in a file, say, hello.txt while ignoring case sensitivity, run the command:
$ grep -i Linux hello.txt
Search For String in a File
To get more options that you can use with grep, simply read our article that examples more advanced grep command examples.
By default, sed command prints the output to STDOUT (Standard Out), implying that the result of the execution is printed on the terminal instead of being saved in a file.
Sed command is invoked as follows:
$ sed -OPTIONS command [ file to be edited ]
For example, to replace all instances of ‘Unix‘ with ‘Linux‘, invoke the command:
$ sed 's/Unix/Linux' hello.txt
Replace String in a File
If you want to redirect output instead of printing it on the terminal, use the redirection sign
( > ) as shown.
$ sed 's/Unix/Linux' hello.txt > output.txt
Redirect Output to File
The output of the command is saved to the output.txt file instead of being printed on the screen.
To check out more options that can be used, once again check out the man pages.
$ man sed
Ack is a fast and portable command-line tool written in Perl. Ack is considered a friendly replacement for grep utility and outputs results in a visually appealing manner.
Ack command searches the file or directory for the lines that contain the match for the search criteria. It then highlights the matching string in the lines.
Ack has the capacity to distinguish files based on their file extensions, and to a certain extent, the content in the files.
Ack command syntax:
$ ack [options] PATTERN [FILE...] $ ack -f [options] [DIRECTORY...]
For example, to check for the search term Linux, run:
$ ack Linux hello.txt
Check a String in a File
The search tool is quite intelligent and If no file or directory is provided by the user, it searches the current directory and subdirectories for the search pattern.
In the example below, no file or directory has been provided, but ack has automatically detected the available file and searched for the matching pattern provided.
$ ack Linux
Search String in a Directory
To install ack on your system run the command:
$ sudo apt install ack-grep [On Debian/Ubuntu] $ sudo dnf install ack-grep [On CentOS/RHEL]
#awk command #linux commands #sed command #commandline tools #linux tricks #linux