Skip to content

Linux terminal on Android

The everyday commands for driving a real Linux shell from a phone — navigating the filesystem, moving files, inspecting processes, managing permissions and following logs. All standard POSIX / GNU coreutils, exactly as they behave on any Linux box.

Print or save this page for offline reference.

Navigating

CommandDescription
pwdPrint the current working directory.
ls -lahList all files, long format, human-readable sizes.
cd -Switch back to the previous directory.
tree -L 2Show the directory tree, two levels deep.

Files & directories

CommandDescription
cp -r src dstCopy a directory recursively.
mv old newMove or rename a file or directory.
mkdir -p a/b/cCreate nested directories, no error if they exist.
rm -rf dirDelete a directory and its contents (irreversible).
ln -s target linkCreate a symbolic link pointing at target.

Viewing & searching

CommandDescription
cat filePrint a file's contents to the terminal.
less filePage through a file (q to quit, / to search).
grep -rn "text" .Recursively search for text, with line numbers.
find . -name '*.js'Find files matching a name pattern.
tail -f app.logFollow a log file live as it grows.

Permissions & ownership

CommandDescription
chmod +x script.shMake a file executable.
chmod 644 fileSet owner read/write, others read-only.
chown user:grp fChange a file's owner and group.
umask 022Set default permissions for new files.

Processes & jobs

CommandDescription
ps auxList every running process with details.
topLive view of CPU and memory usage.
kill -9 PIDForce-terminate a process by its PID.
cmd &Run a command in the background.
jobs / fg %1List background jobs; bring one to the foreground.

Pipes & redirection

CommandDescription
cmd > out.txtRedirect output to a file (overwrite).
cmd >> out.txtAppend output to the end of a file.
a | bPipe the output of a into b as input.
cmd 2>&1Merge stderr into stdout.
cmd1 && cmd2Run cmd2 only if cmd1 succeeds.

System & network

CommandDescription
df -hShow free disk space, human-readable.
du -sh *Show the size of each item in the folder.
free -hShow total, used and free memory.
curl -I urlFetch only the HTTP response headers of a URL.
env / export X=1List environment variables; set one for the session.

Put this to work on Android with the Terminal & SSH.

More cheatsheets