You can use tail command as follows:
tail -100 <log file> > newLogfile
Now last 100 lines will be present in newLogfile
EDIT:
More recent versions of tail as mentioned by twalberg use command:
tail -n 100 <log file> > newLogfile
Related Posts:
- Retrieve last 100 lines logs
- “sed” command in bash
- How to use sed to extract substring
- How to add a timestamp to bash script log?
- How to display certain lines from a text file in Linux?
- Is there a proper way to clear logs?
- Chmod 777 to a folder and all contents [duplicate]
- Amazon Linux: apt-get: command not found
- How do I find all files containing specific text on Linux?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to install grub after installing Windows 10
- Linux: ‘Username’ is not in the sudoers file. This incident will be reported
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- QEMU: /bin/sh: can’t access tty; job control turned off
- Explaining the ‘find -mtime’ command
- Meaning of exit status 1 returned by linux command
- Creating a new directory in C
- Extract file basename without path and extension in bash
- How to change permissions for a folder and its subfolders/files in one step
- mv: cannot stat error : No such file or directory error
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- Pseudo-terminal will not be allocated because stdin is not a terminal
- linux command to get size of files and directories present in a particular folder?
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- ./configure : /bin/sh^M : bad interpreter
- TCP congestion control version: HTCP module vs highspeed module in linux kernel
- How to use regex with find command?
- What is the difference between /etc/rc.local and ~/.bashrc?
- Snort Message – WARNING: No preprocessors configured for policy 0
- Compile the Fortran program in Windows using gfortran
- Yum fails with – There are no enabled repos.
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- sed command with -i option failing on Mac, but works on Linux
- Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel
- How to make rpm auto install dependencies
- How do I install chkconfig on Ubuntu?
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Apache server keeps crashing, “caught SIGTERM, shutting down”
- List all mounts in Linux
- Wait for user input in C?
- Difference between exec, execvp, execl, execv?
- Configuring Apache for localhost
- Restarting cron after changing crontab file?
- cd into directory without having permission
- How do I know the script file name in a Bash script?
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- WordPress cloning issue
- Can scp copy directories recursively?
- What are the functional differences between .profile .bash_profile and .bashrc
- Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?
- Linux command to inspect TXT records of a domain [closed]
- df in linux not showing correct free space after file removal
- Setting the hostname: FQDN or short name?
- When does /tmp get cleared?
- What does a + mean at the end of the permissions from ls -l?
- How do I sleep for a millisecond in bash or ksh
- What does ‘set -e’ do, and why might it be considered dangerous?
- What version of RHEL am I using?
- What useful things can one add to one’s .bashrc? [closed]
- How do you make it obvious you are on a production system?
- How can I verify if TLS 1.2 is supported on a remote web server from the RHEL/CentOS shell?
- How to remove empty/blank lines from a file in Unix (including spaces)?
- Mount CIFS Host is down
- List of files installed from apt package
- How can I kill all stopped jobs?
- How to copy a large number of files quickly between two servers
- How to copy file preserving directory path in Linux?
- Postfix – how to retry delivery of mail in queue?
- Allow SFTP but disallow SSH?
- Is it possible to alias a hostname in Linux?
- How do I list loaded Linux module parameter values?
- Does getting disconnected from an SSH session kill your programs?
- Tips for Securing a LAMP Server
- What Linux distribution is the Amazon Linux AMI based on?
- What is this IP address: 169.254.169.254?
- How can I export the privileges from MySQL and then import to a new server?
- Is there a directory equivalent of /dev/null in Linux?
- Can I send some text to the STDIN of an active process running in a screen session?
- How can I get processor/RAM/disk specs from the Linux command Line? [duplicate]
- Should I install Linux applications in /var or /opt?
- Is there a way to see the execution tree of systemd?
- How to determine the hostname from an IP address in a Windows network?
- Heartbleed: how to reliably and portably check the OpenSSL version?
- create home directories after create users
- How can I fully log all bash scripts actions?
- How do I redirect subdomains to a different port on the same server?
- Running Cron every 2 hours [duplicate]
- How to check the physical status of an ethernet port in Linux?
- What does “debconf: delaying package configuration, since apt-utils is not installed” mean?
- Testing UDP port connectivity
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?
- memcache vs memcached?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- What is the debian-sys-maint MySQL user (and more)?