Сответствие консольных команд Windows и Linux.
При переходе с Windows на Linux и наоборот, для тех, кто знаком с командной строкой, может пригодиться небольшая справка по соответствию консольных команд этих операционных систем. Естественно, полного соответствия, за редким исключением, не бывает, и в приведенной таблице собраны команды, идентичные по результатам выполнения или функционально близкие.
Соответствие команд CMD Windows командам Linux
Описание | Команда CMD Windows | Команда Linux |
Вызов справочной системы | HELP | apropos, man, whatis |
Вызов командного интерпретатора (оболочки) | CMD | bash, csh, sh |
Очистка экрана | CLS | clear, reset |
Вывод сообщения на экран | ECHO | echo |
Пауза в работе | PAUSE | sleep |
Настройка параметров терминала | MODE | stty |
Установка значений переменных окружения (указание путей к каталогам) | PATH, SET, SETx | env, set |
Изменение системной даты | DATE | date |
Изменение системного времени | TIME | date |
Выход из командной строки | EXIT | exit |
Работа с файлами и каталогами | ||
Отображение списка файлов и каталогов | DIR | dir, ls |
Создание каталога | MKDIR | mkdir |
Удаление каталога | RMDIR | rmdir |
Удаление файла | DEL, ERASE | rm |
Переход в другой каталог | CD | cd |
Копирование файлов или каталогов | COPY, XCOPY | cp |
Переименование файла | REN, RENAME | mv |
Перемещение файлов | MOVE | mv |
Поиск файла | WHERE | find, locate |
Вывод на экран содержимого файла | TYPE, MORE | cat, less, more |
Сравнение содержимого двух файлов | COMP, FC | cmp, diff, diff3, sdiff |
Сортировка строк в текстовом файле | SORT | sort |
Изменение атрибутов файла | ATTRIB | chmod |
Создание символьной ссылки на файл или каталог | MKLINK | ln |
Резервное копирование данных | ROBOCOPY | cpio, tar |
Вызов текстового редактора | EDIT (нет в Windows Vista и старше) | vi |
Работа с томами и разделами | ||
Создание разделов | FDISK | fdisk |
Управление разделами | DISKPART | parted, partx |
Форматирование диска, создание файловой системы | DISKPART, FORMAT | mformat, mkfs |
Проверка файловой системы | CHKDSK | fsck |
Управление системой. | ||
Отобразить список процессов | TASKLIST, QUERY PROCESS | ps |
Уничтожить процесс | TASKKILL | kill, killall |
Перезагрузить компьютер | SHUTDOWN | shutdown, reboot |
Выключить компьютер | SHUTDOWN | shutdown, halt |
Выполнить команду от имени другого пользователя | RUNAS | sudo |
Отобразить имя компьютера | HOSTNAME | hostname |
Пользователи и группы. | ||
Создать нового пользователя | NET USER | useradd |
Изменить параметры пользователя | NET USER | usermod |
Изменить пароль пользователя | NET USER | passwd |
Удалить пользователя | NET USER | userdel |
Создать новую группу пользователей | NET GROUP | groupadd |
Изменить параметры группы | NET GROUP | groupmod |
Удалить группу | NET GROUP | groupdel |
Отобразить список активных пользователей | QUERY USER | users |
Работа с сетью. | ||
Работа с таблицей соответствия IP и MAC адресов ARP | arp | arp |
Конфигурация протокола IP | IPCONFIG, NETSH | ifconfig, ip |
Работа с таблицей маршрутизации | ROUTE | route |
Опрос узла по протоколу ICMP | PING | ping |
Клиент Telnet | TELNET | telnet |
Работа с DNS-сервером в интерактивном режиме | NSLOOKUP | dig, nslookup |
Трассировка маршрута к удаленному узлу | TRACERT | traceroute |
Отобразить статистику сетевых соединений | NETSTAT | netstat |
Строчные и заглавные буквы для команд командной строки Windows воспринимаются одинаково, ECHO и echo — будет интерпретировано как одна и та же команда. При работе в командной строке Linux соблюдение регистра символов обязательно.
Если вы желаете помочь развитию проекта, можете воспользоваться кнопкой «Поделиться» для своей социальной сети
real windows equivalent to cat *stdin*
Under cmd is there a windows equivalent to the posix command cat ?
cat all by itself no filenames, no switches. I just want something that copies stdin to stdout until it hits EOF.
it’s not a hard program to write, but is one provided by windows?
the answer is not necessarily a single word and is definately not type.
just gets me an error message
hangs wainting for me to type some stuff
is close, but «more»` halts after one screenfull.
The reason I want this is for running a program that behaves differently when stdout is into a pipe. so I can see the output.
4 Answers 4
someprog | findstr x* or any other single character followed by asterisk copies all lines from the pipe stdin to stdout. Specifically, it copies each line if it either does contain an x or doesn’t, which you can easily see is always true. Windows findstr is roughly equivalent to Unix grep but with annoying minor differences in the syntax.
findstr is intended for text and I’m not sure (and didn’t test) if it works for binary data with few or no [CR]LFs and therefore very long apparent lines. Unix cat with no args does work for binary, but your stated use case is programs that alter their output for pipes and in my experience that only happens on text output — and usually is not pipes as such but rather NON-tty/NON-console/etc and therefore I can test equally well with someprog >temp; cat temp on Unix or & type on Windows unless the program is interactive and I need to see one output before entering the next input.
Is there replacement for cat on Windows
I need to join two binary files with a *.bat script on Windows.
How can I achieve that?
11 Answers 11
Windows type command works similarly to UNIX cat .
Example 1:
is equivalent of:
Example 2:
This command will merge all the vcards into one.
You can use copy /b like this:
If you have control over the machine where you’re doing your work, I highly recommend installing GnuWin32. Just «Download All» and let the wget program retrieve all the packages. You will then have access to cat, grep, find, gzip, tar, less, and hundreds of others.
GnuWin32 is one of the first things I install on a new Windows box.
600 kB exe incorporating
30 Unix utilities. The only difference is that one should use «busybox cat» command instead of simple «cat» – Fr0sT Jan 10 ’14 at 13:59
Shameless PowerShell plug (because I think the learning curve is a pain, so teaching something at any opportunity can help)
Note that type is an alias for Get-Content, so if you like it better, you can write:
Just use the dos copy command with multiple source files and one destination file.
You might need the /B option for binary files
In Windows 10’s Redstone 1 release, the Windows added a real Linux subsystem for the NTOS kernel. I think originally it was intended to support Android apps, and maybe docker type scenarios. Microsoft partnered with Canonical and added an actual native bash shell. Also, you can use the apt package manager to get many Ubuntu packages. For example, you can do apt-get gcc to install the GCC tool chain as you would on a Linux box.
If such a thing existed while I was in university, I think I could have done most of my Unix programming assignments in the native Windows bash shell.
If you simply want to append text to the end of existing file, you can use the >> pipe. ex:
If you have to use a batch script and have python installed here is a polygot answer in batch and python:
If saved as join.bat usage would be:
Thanks too this answer for the inspiration.
I try to rejoin tar archive which has been splitted in a Linux server.
Реализация команды «cat» в консоли Windows
В общем задание следующее: В консоли Linux есть команда «cat», аналог которой надо сделать под консоль Windows на языке C++. В идеале требуется реализация посредством WinAPI, но можно и иначе. Шарил в сети код, но ничего толкового не нашел, а лишь это .
Реализация UNIX команды «cat» в консоли Windows с использованием WinAPI
В консоли Linux есть команда «cat», аналог которой надо сделать под консоль Windows на языке C++.
Реализация команды «tail» на Windows на языке C++
В общем задание следующее: В консоли Linux есть команда «tail», аналог которой надо сделать под.
Что означают команды «fun», «my_max», «my_min» в C++?
Мне нужно защищать программу, а я писал её не сам, и в универе мы эти команды ещё не проходили, и.
Тематические курсы и обучение профессиям онлайн Профессия Разработчик на C++ (Skillbox) Архитектор ПО (Skillbox) Профессия Тестировщик (Skillbox) |
Вы бы хоть заданием поинтересовались.
google -> «unix cat» -> читать первую ссылку на википедию -> посмотреть примеры работы утилиты -> посмотреть на код -> понять что, вау, оно вроде делает что надо -> подогнать под винду
Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь или здесь.
Для каждой строки найти слова, которые не имеют ни одного из букв: «l», «k», «r», «s» i «j»
Задано символьные строки. Строка состоит из нескольких слов (наборов символов), которые разделяются.
Как можно заменить все слова «fox» на «cat» ?
Привет Нашел пример замены слова. А как можно заменить все слова «fox» на «cat» Function.
Реализация команды «Сохранить» в блокноте
Создаю блокнот в С#, дошёл до «сохранить» и «сохранить как. » «Сохранить как. » сделал, а просто.
real windows equivalent to cat *stdin*
Under cmd is there a windows equivalent to the posix command cat ?
cat all by itself no filenames, no switches. I just want something that copies stdin to stdout until it hits EOF.
it’s not a hard program to write, but is one provided by windows?
the answer is not necessarily a single word and is definately not type.
just gets me an error message
hangs wainting for me to type some stuff
is close, but «more»` halts after one screenfull.
The reason I want this is for running a program that behaves differently when stdout is into a pipe. so I can see the output.
4 Answers 4
someprog | findstr x* or any other single character followed by asterisk copies all lines from the pipe stdin to stdout. Specifically, it copies each line if it either does contain an x or doesn’t, which you can easily see is always true. Windows findstr is roughly equivalent to Unix grep but with annoying minor differences in the syntax.
findstr is intended for text and I’m not sure (and didn’t test) if it works for binary data with few or no [CR]LFs and therefore very long apparent lines. Unix cat with no args does work for binary, but your stated use case is programs that alter their output for pipes and in my experience that only happens on text output — and usually is not pipes as such but rather NON-tty/NON-console/etc and therefore I can test equally well with someprog >temp; cat temp on Unix or & type on Windows unless the program is interactive and I need to see one output before entering the next input.