newbedev.com Open in urlscan Pro
2606:4700:3037::ac43:d22d  Public Scan

URL: https://newbedev.com/windows-equivalent-of-the-tail-command
Submission Tags: falconsandbox
Submission: On December 07 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Menu
NEWBEDEVPythonJavascriptLinuxCheat sheet
Contact

NEWBEDEV
 * Python
 * Javascript
 * Linux
 * Cheat sheet
 * Contact
 * 





WINDOWS EQUIVALENT OF THE 'TAIL' COMMAND

00:01 / 00:15

Start Windows 10 In Command Prompt

IF you have Windows PowerShell installed (I think it's included since XP) you
can just run from cmd.exe:

Head Command:

powershell -command "& {Get-Content *filename* -TotalCount *n*}"


Tail Command:

powershell -command "& {Get-Content *filename* | Select-Object -last *n*}"


or, directly from PowerShell:

Get-Content *filename* -TotalCount *n*
Get-Content *filename* | Select-Object -last *n*



update

PowerShell 3.0 (Windows 8 and higher) added Tail command with alias Last. Head
and First aliases to TotalCount were also added.

So, commands can be re-written as

Get-Content *filename* -Head *n*
Get-Content *filename* -Tail *n*



No exact equivalent. However there exist a native DOS command "more" that has a
+n option that will start outputting the file after the nth line:

DOS Prompt:

C:\>more +2 myfile.txt


The above command will output everything after the first 2 lines.
This is actually the inverse of Unix head:

Unix console:

root@server:~$ head -2 myfile.txt


The above command will print only the first 2 lines of the file.


more /e filename.txt P n


where n = the number of rows to display. Works fast and is exactly like head
command.


TAGS:

WINDOWS

COMMAND LINE


RELATED

Can you run AD on a non-Windows server?kubernetes client-go plugin exec command
not found on Windows 10How can I connect to Postgres running on the Windows host
from inside WSL2?Windows 2019: can't figure out why my drive is fullHow to get
all processes under a session of a particular process that is using a port in
Windows cmdMicrosoft Windows Server 2019 standard evaluation won't accept
product code for brand new windows server 2019 essentialsA network file on
windows is different for different usersHow to migrate physical server to VMware
VMPrint Spooler Crashing After KB4561608 with Ricoh PrintersHow do I install an
app from Windows Store using Powershell


RECENT POSTS

Pandas how to find column contains a certain valueRecommended way to install
multiple Python versions on Ubuntu 20.04Build super fast web scraper with Python
x100 than BeautifulSoup

© 2021 newbedevPrivacy Policy