Learn three approaches for awk to print records in the same line with examples.
Kai Yuan has been a software developer for over 15 years. He builds enterprise Java applications in work. He has 20 years experience of Linux and is a big fan of the Vim editor. He is happy to help people at stackoverflow.com. He lives currently in Hamburg.
Here's what I've written (so far):
Baeldung on Linux
- Files (52)
- Scripting (36)
- File Editing (20)
- Administration (15)
- Processes (9)
- File Searching (8)
- Filesystems (6)
- File Viewing (4)
- Search (3)
- File Permissions (3)
- Web (2)
- Security (1)
- File Compression (1)
Learn how to use the grep command to filter strace’s output.
Learn how to search multiple strings using only one grep process
Learn how to tell find to output only filenames without extensions.
Learn three approaches to using an external command to process shell variables
Learn how to sum up the size of listed files using the ls and find commands
Learn two methods to recursively find statistics on file types in a directory
Learn how to get an executable’s path when it’s in an alias
Learn how to output a blank line after each line in the file using Linux command-line tools.
Learn how to implement a customizable, reusable command line progress bar using shell script.
Learn how to set column rulers in the Vim editor and customize them.
Explore how to overwrite an output line using the echo and printf commands.
Learn how to list only the names of the files that match the given pattern.
Learn how to find the user’s name by a given UID
Learn how to find desired processes and preserve the header line of ps’s output.
Learn how to find processes’ information by a keyword.
Learn how to check the cron jobs’ logs for two common cron implementations and two different logging systems.
Learn how to use the find command to list non-empty files under a directory
Learn some tricks to reuse different parts from the last command in Bash
Start from a script example and discuss a case we should avoid using && when writing shell scripts
Learn how to use awk to remove duplicate lines from an input file
Learn how to identify the current user in Linux
Learn how to add a new column to a given TSV file in the Linux command line
Explore how to get the process name by a given PID
Learn how to use Bash’s += operator and parameter expansion to concatenate variables
Learn the difference between sourcing a script and executing a script in Linux through examples
Learn how to clear only a file’s content from the Linux command line and keep the empty file
Learn how to check if the current Java environment is Oracle JDK or OpenJDK
Learn how to parse CSV format data in Bash through examples
Learn how to search a pattern and apply some text substitution in the next line using sed and awk
Learn three approaches to search for a pattern in a file, starting after a given line number
Learn two approaches to extracting fields from input when the delimiter is multiple spaces
Learn how to list the files in a Zip archive without decompressing it
Learn why Regex \d isn’t supported by Linux commands such as grep and sed
Learn how to substitute shell variables with their values in a text file in the Linux command line
Learn three approaches using grep to search files and move the found files to a directory in one shot
Take a closer look at the /bin/true and /bin/false commands with some use cases
Learn how to do grep on a tar.gz archive to find which files contain an interesting pattern
Learn how to swap two files’ content using three mv commands
Learn how to perform various rounding methods in Bash
Learn how to set environment variables only for one single command
Learn how to only print the n-th line after the match using grep, sed, and awk
Learn how to return different values from sed and awk depending on the substitution result
Learn how to use the xargs command to handle multiple arguments
Learn how to use the find and tar commands to archive files of certain types
Learn approaches to run a command as the superuser without asking for a password
Learn how to copy directories recursively while excluding hidden files and directories
Take a closer look at wget’s timeout settings
Our Linux distro may contain a mixture of 32 and 64 bit libraries. We can find out the architecture the library was built for by using a couple of commands. We explore how to do this for static and shared libraries.
Learn how to use the ls command to list one file per line
Learn how to include additional scripts in the .bashrc file through examples
Take a closer look at how to use the sed command’s feature for inserting a new line when the new line contains spaces
Learn two ways to get the last word from each line of a file
Learn how to build simple shell scripts to log the CPU usage of a single process
Learn how to get a directory’s last modification time and what changes to a directory will affect the modification time
Learn how to column-wise combine two input files through examples
Learn how to split an input file with the header line using the split and awk commands
Learn several ways to open a URL in the default browser from the Linux command line
Learn how to delete files listed in another file using pure Bash, xargs, sed, and awk
Learn how to delete lines from a given line number until the end of the file using head, sed, and awk
Learn different approaches to read a specific line from a file
Learn how to extract the last component from a given path string
Learn two different ways to get the current login user in the shell script and a few common pitfalls
Learn various ways to extract substrings using the Linux command line
Learn how to recursively copy a directory to an existing directory with or without overwriting
Learn how to overcome the “Permission denied” error when redirecting output to a file.
Learn how to remove the last character from all lines in a file through examples
Learn how to remove a symbolic link using the rm and unlink commands
See why linebreaks in a shell variable can disappear in echo’s output and learn the right way to use shell variables in commands
Learn three different ways to delete files or directories found by the find command
Learn how to execute grep on a set of filtered files
Learn how to extract data lines between two patterns.
Learn how to create soft links to directories through examples
Learn two approaches to get all groups defined on the system
Learn three different ways to clone a directory structure without copying files under it through examples
Learn how to create the non-existing target directory automatically when we copy files
Learn how to search for files not owned by a particular user using the find command
Learn how to change a user’s default shell through examples
Take a closer look at how to do multiple variable assignment in Bash scripts
Learn how to send a GUI notification from a shell script using notify-send and zentity
Take a closer look at some common mistakes made using sed substitution with shell variables
Learn how to evaluate XPath expressions using xmllint, XMLStarlet, and xidel
Have a look at how to use the sed command to process a literal string or shell variable.
Learn how to remove the first line from using sed, awk, and tail
Learn about each type of Vim register through examples
Learn several approaches to remove the lines that appear in file B from another file A
Learn different ways to remove the last n lines from an input file and the performance of those approaches
Learn how to split a file at given line numbers using head, tail, sed, and awk
Learn how to delete multiple files in one shot from the Linux command line
Learn how to call shell script functions from outside the shell script file
Learn a few ways to count repeated lines in a text file
Learn how to implement a counter in a Bash script and some common pitfalls
Learn how to do in-place editing with the awk command through examples
Learn how to search and replace in text files recursively through examples
Learn how to determine virtualization technology using Linux commands
Learn how to send the output of a command to multiple commands using three different solutions through examples
Learn different ways to find the longest lines from an input file and benchmark their performance
Learn several ways to pretty-print an XML file using Linux commands
Learn a few ways to save multi-line output into a Bash array
Learn several ways to list all shared libraries used by a program
Learn how to call an external program using awk
Learn about three common approaches to start a process and let it run in the background as a job
Compare different ways to shuffle lines in text and discuss their pros and cons
Explore some common scenarios for removing blank lines from a file through practical examples
Learn several ways to merge multiple lines of input into a single line with customized delimiters
Learn how to process multiple input files using the awk command using simple examples
Learn how to get login related information using the last and lastb commands
Learn some useful commands to reboot and shut down a Linux system from the command line
Learn how to do the “uniq” operation on a column instead of the entire line
We’ll take a closer look at the date utility and learn its common usages
Learn about the typical usages of the head and tail command through examples.
Learn how to use the watch command to execute a command periodically and check the output of each execution
Learn the echo command and its options through examples
Learn the sort command through various examples
Learn about special file permission flags in Linux
Learn how to use the tr command through various examples
Learn about two types of file locks in Linux some related commands through examples
Learn about MIME types and how to get the MIME type of a file using Linux command-line utilities
Depending on the Linux distro and use case, there are a few available tools that can rename a batch of files. We explore some common use cases.
Learn different approaches to finding the process listening on a particular port in Linux
Learn how to use the Linux mount command to attach various filesystems and detach them with umount
Learn about some useful file manipulation commands in Linux.
Learn how to perform some common text searching in Linux using the grep command-line utility