Getting Started with NetNIX

Everything you need to know to install, configure, and use your virtual UNIX environment.

01 — Installation

System Requirements

  • .NET 8.0 Runtime (or SDK if building from source)
  • Any platform supported by .NET 8: Windows, macOS, Linux, Android (via Termux)
  • Console/terminal application — no GUI required
  • Disk space: ~30 MB for the application + rootfs archive

Option A: Windows Installer

Download the installer from the downloads page and run it. The installer will guide you through the process.

Option B: Build from Source

Build from source
# Clone the repository $ git clone https://github.com/squiblez/NetNIX.git $ cd NetNIX # Build the project $ dotnet build # Run NetNIX $ dotnet run --project NetNIX

02 — First-Time Setup

When NetNIX starts for the first time (no rootfs.zip exists), it runs the First-Time Setup wizard automatically:

  • Creates the standard UNIX directory hierarchy (/bin, /etc, /home, …)
  • Installs default skeleton files for new users
  • Prompts you to set a root password
  • Creates the root account and the sudo group
  • Optionally creates a regular user account
  • Installs the sandbox configuration (/etc/sandbox.conf)
  • Installs all built-in commands into /bin and /sbin
  • Installs built-in libraries into /lib
  • Installs manual pages into /usr/share/man
  • Installs factory files (default configs, demo scripts)
  • Saves everything to the rootfs.zip archive

After setup, you are presented with the login prompt.

03 — Using the Shell (nsh)

After logging in, you are dropped into nsh (NetNIX Shell). The prompt shows your username, hostname, current directory, and privilege level:

user@netnix:/home/user$          (regular user)
root@netnix:/root#               (root)

Basic Usage

SyntaxDescription
command arg1 arg2Run a command with arguments
command > fileRedirect output to a file
command >> fileAppend output to a file
cmd1 | cmd2 | cmd3Pipe output between commands
helpShow all available commands
man <topic>Read the manual page for a topic
clearClear the screen
exit / logoutLog out of the current session

Shell Scripts

Source a file containing one command per line:

source myscript.sh
. myscript.sh

Lines starting with # are treated as comments. The file ~/.nshrc is automatically sourced on login.

04 — Built-in Commands

Shell Builtins

CommandDescription
helpShow command overview
manManual page viewer
cdChange directory (cd, cd ~, cd -)
chmodChange file permissions
chownChange file owner (root only)
adduserCreate a new user (root only)
suSwitch user
sudoRun a command as root
daemonManage background services
runRun a .cs script file
source / .Execute a shell script

User Commands (/bin)

CommandDescription
lsList directory contents
catDisplay file contents
cp / mv / rmCopy, move/rename, remove files
mkdir / rmdirCreate/remove directories
grepSearch file contents with patterns
findFind files by name pattern
head / tailDisplay first/last lines of a file
wcWord, line, and character count
curl / wget / fetchNetwork transfer tools
editBuilt-in text editor
zip / unzipArchive management within the VFS
echo / pwd / whoamiPrint text, directory, or username

System Administration (/sbin — root/sudo)

CommandDescription
useradd / userdel / usermodManage user accounts
groupadd / groupdel / groupmodManage groups
mount / umountMount/unmount .zip archives
export / importfileBridge to host filesystem
npakPackage manager
nxconfigHost-side configuration tool
httpdHTTP server daemon
telnetdTelnet server daemon (remote multi-user access)

05 — Virtual File System

NetNIX uses a fully in-memory virtual filesystem persisted as a .zip archive. All paths are UNIX-style (forward slashes, rooted at "/").

Default Archive Location

PlatformPath
Windows%APPDATA%\NetNIX\rootfs.zip
Linux~/.config/NetNIX/rootfs.zip
macOS~/Library/Application Support/NetNIX/rootfs.zip

Directory Layout (FHS)

PathPurpose
/binUser command scripts
/sbinSystem/admin command scripts
/libShared libraries
/etcConfiguration files
/homeUser home directories
/rootRoot's home directory
/tmpTemporary files (world-writable)
/usrSecondary hierarchy (bin, lib, share)
/varVariable data (logs, packages, www)
/mntMount points for external archives

Permissions

Every file and directory has a 9-character permission string representing owner, group, and other access. Root (uid 0) bypasses all permission checks.

chmod rwxr-xr-x myfile       # symbolic notation
chmod 755 myfile             # octal notation
chown username myfile        # change owner (root only)

06 — Writing C# Scripts

Scripts are plain-text .cs files stored in the virtual filesystem. They are compiled at runtime by Roslyn and executed inside the NetNIX sandbox.

Basic Structure

/bin/mycommand.cs
using System; using NetNIX.Scripting; public class MyCommand { static int Run(NixApi api, string[] args) { Console.WriteLine("Hello from NetNIX!"); return 0; // 0 = success } }

The NixApi Object

The api parameter provides safe access to the entire environment:

CategoryMethods
File I/OReadText, WriteText, ReadBytes, WriteBytes, AppendText, Exists, Delete, Copy, Move
DirectoriesIsDirectory, ListDirectory, CreateDir, CreateDirWithParents
PathsResolvePath, GetName, GetParent, Cwd
UsersUid, Gid, Username, GetUsername, GetGroupName
PermissionsCanRead, CanWrite, CanExecute, GetPermissions
NetworkingNet.Get, Net.Post, Net.Put, Net.Delete, Net.Patch, Net.Head
Host LoggingHostLog, HostLogRaw
PersistenceSave

The #include System

#include <libraryname>         // Search /lib, /usr/lib, /usr/local/lib
#include "path/to/file.cs"     // Resolve relative to cwd or absolute

Built-in Libraries

LibraryDescription
demoapilibDemo/example library showing API usage patterns
netlibNetworking helper library
settingslibPersistent key/value settings storage for scripts
ziplibZip archive manipulation within the VFS
Full Documentation

NetNIX includes 80+ built-in manual pages. Once inside the environment, use man <topic> to read detailed documentation on any command or concept, man --list to see all available pages, or man -k <keyword> to search.