sed tutorial: sed insert line before match
Sed insert a line before match, you can use the sed function: i, add a new line before the matched string. syntax: sed '/option/i...
sed tutorial: sed add line after match
sed add line after match, you use sed function: a , to add a new line after the matched string. syntax: sed '/option/a newLine'...
lsof command tutorial in linux/unix with examples and use cases
The lsof command can not only view the files and directories opened by the process, but also view the socket-related information such as the port...
How to recover deleted files in Linux
Linux recover deleted files, we can use the debugfs command. It can be used to examine and change the state of an ext2, ext3,...
mkdir no such file or directory in linux/unix
mkdir no such file or directory - This error is reported because you created a multi-level directory and the intermediate directory does not exist. We...
mkdir if not exists in linux/unix
mkdir creates a directory if it does not exist, we can use the mkdir -p option. syntax: mkdir -p foo/bar/baz, will create directories foo, foo/bar,...
How to use awk concatenate string in linux/unix
Awk concatenated strings, you can use awk OFS variables, or you can use strings directly. syntax: awk'BEING {s1="string1";s2="string2";OFS="delimiter";print s1,s2;}'...
How to use awk to select substring in linux/unix
Awk substr has built-in functions that can help us select substrings anywhere in the input string. awk substr syntax: substr(string, start, lenght)...
How to find file by name in linux/unix
To find files by name, we can use the linux find command. For example: find directory -type f -name "filename"...
The difference between ls, ls -a, ls -A, ls -l, ls -al, ls -lrt
ls -a : display all files and subdirectories in the current directory, including hidden "." And ".." etc; ls -l : display...
Sort files or folders by date/time with ls command in linux/unix
In linux/unix ls -t option can be sorted by date from newest to oldest, or ls -rt option can be sorted by date from oldest...
How does grep exclude directory, file, keyword in Linux/unix
Grep command supports multiple exclusion methods, including grep exclude directory, grep exclude file, grep exclude binary files, and grep exclude keywords....
How to grep ignore case in linux/unix
In linux/unix, we can use the grep -i option to ignore case matching search keywords. grep ignore case syntax: grep -i "keyword" file...
How does the top command sort by memory in linux/unix
Linux top sort by memory can help us find out which processes use more memory. It has two ways to sort memory: top -o option...
tr command tutorial in linux/unix with examples and use cases
linux tr command common examples: replacing specific characters, removing specific characters, deleting duplicate characters, etc....