This can be done using the tail command.
tail -n +2 file.txt > file.tmp && mv file.tmp file.txtWe use a temporary file here as the redirection (>) from tail happens before tail is invoked by the shell. If we just redirected straight into the file we would get an empty file.
The sed command can also be used.
sed -i '1d' file.txtOr using a combination of cat and sed, which needs the same redirection as the tail command above.
cat file.txt | sed 1d > file.tmp && mv file.tmp file.txt
Add new comment