no
no is a console program that toggles the presence of a leading
no on lines of text piped through it. I wrote it to more easily bulk-configure
Cisco devices, where prefixing a command with no negates it — so flipping a whole
config block on or off becomes a single pass through no.
Toggle in action
By default each line is toggled: lines that start with no have it removed, and
lines that don't have it added. Leading indentation is preserved, so it works cleanly on indented
configuration blocks:
| input | cat config.txt | no |
|---|---|
interface GigabitEthernet0/1 shutdown no ip address no cdp enable |
no interface GigabitEthernet0/1 no shutdown ip address cdp enable |
What's new in this version
- NEW Indentation aware. Leading whitespace is preserved and the
nois added or removed after the indent — perfect for nested Cisco config. - NEW Reads files too. Pass one or more file names (or
-for stdin) instead of, or in addition to, piping. - NEW Case-insensitive matching with
-i, soNOis recognised as well asno. - NEW Newline-faithful. A trailing newline is emitted only if the input line had one; blank and whitespace-only lines pass straight through.
- NEW Predictable CLI. Unknown options are reported as errors,
--ends option parsing, and-a/-d/-tfollow last-one-wins. - Ships with a Makefile (
make,make check,make install,make deb), a man page, and a test suite.
Usage
no [OPTION]... [FILE]...
With no FILE, or when FILE is -, no reads standard input.
| Option | Description |
|---|---|
-t, --toggle | Default behavior: add no where it is missing, remove it where present. |
-a, --add | Always add a leading no if it isn't present; never strip. |
-d, --delete | Always strip a leading no if it is present; never add. |
-i, --ignore-case | Match a leading no case-insensitively (e.g. NO ). |
-v, --version | Print version information and exit. |
-h, --help | Print a usage summary and exit (also --usage, -?). |
-t, -a, and -d are mutually exclusive; the last one given wins.
--add and --delete are idempotent, and a double --toggle round-trips
back to the original text.
More examples
# toggle a whole file (pipe or pass the file directly) cat config.txt | no no config.txt # unconditionally strip every leading 'no ' no --delete config.txt # build a "negated" copy of a config to paste in and undo changes no --add running-config.txt > undo.txt # normalise mixed-case 'No '/'NO ' while toggling no -i config.txt
Building & installing
Requires a C++ compiler (g++ by default) and make.
make # build ./no make check # run the test suite sudo make install # install to /usr/local sudo make install PREFIX=/usr # Debian/Ubuntu/Kali: build and install a .deb (program + man page) make deb sudo dpkg -i no_*.deb
License
GPLv3 or later. See the source header for details.
Download:
Listing directory https://download.elifulkerson.com/files/no/0.2:Makefile June 01 2026 05:36:38 2182 makefile script, ASCII text, with very long lines
README.md June 01 2026 05:36:38 2967 UTF-8 Unicode text
no June 01 2026 05:37:15 28736 ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1cc75fc15e879610d75f083b910c4046cfd5932b, for GNU/Linux 3.2.0, not stripped
no.1 June 01 2026 05:36:38 2500 troff or preprocessor input, ASCII text
no.asc June 01 2026 05:39:13 801 GnuPG signature
no.cpp June 01 2026 05:36:38 5599 C++ source, ASCII text
no.md5 June 01 2026 05:39:13 37 MD5 checksum
no.sha1 June 01 2026 05:39:13 45 SHA1 checksum
no.sha256 June 01 2026 05:39:13 69 SHA256 checksum
no.sha512 June 01 2026 05:39:13 133 SHA512 checksum
no_0.2_amd64.deb June 01 2026 05:37:57 9968 Debian binary package (format 2.0)
no_0.2_amd64.deb.asc June 01 2026 05:39:21 801 GnuPG signature
no_0.2_amd64.deb.md5 June 01 2026 05:39:21 51 MD5 checksum
no_0.2_amd64.deb.sha1 June 01 2026 05:39:21 59 SHA1 checksum
no_0.2_amd64.deb.sha256 June 01 2026 05:39:21 83 SHA256 checksum
no_0.2_amd64.deb.sha512 June 01 2026 05:39:21 147 SHA512 checksum
tests June 01 2026 05:42:45 - directory ↩ Browse the download server