Command-line commands

GNU/Linux (Bash) and Windows (PowerShell)

Topic GNU/Linux (Bash) Windows (PowerShell)
Navigation pwd, ls, cd. Definition of path and wildcards in computing. pwd, ls, cd. Definition of path and wildcards in computing.
Help man command, command --help, command -h, info command. man command, man command -Online.
Manipulation cp, mv, rm, mkdir, ln. cp, mv, rm, mkdir, New-Item.
Administration su root, sudo (enable sudo on Debian). Right-click and run PowerShell as Administrator.
Visualization cat, more (head, tail), grep. cat, more, Select-String.
Printing echo, echo $PATH (show the content of variable PATH). echo, echo $env:Path (show the content of variable PATH).
Execution I ./executable (not in PATH). ./executable (not in PATH).
Execution II comm_1 && comm_2 && comm_N. (comm_1), (comm_2), (comm_N).
Scripting bash script.sh, ./script.sh (executable with #!/bin/bash). ./script.ps1 (about Execution Policies).
Redirection command > text_file (new), command >> text_file (append). command > text_file (new), command >> text_file (append).
Pipelines command_1 | command_2 | command_N. command_1 | command_2 | command_N.
Background command &. Start-Job -ScriptBlock {command}.
Permissions chmod (tip: use ls -l before), chown, chgrp.
Users id, who, whoami, su, sudo, adduser, usermod, deluser, passwd. Get-LocalUser, New-LocalUser, Remove-LocalUser, more.
Groups groups, addgroup, delgroup, groupmod. Get-LocalGroup, New-LocalGroup, Remove-LocalGroup, more.
Processes ps, jobs (fg, bg), kill, killall, top. ps, Get-Job, kill.
Information file path, stat path, wc path.
Networking ping, traceroute, ip, netstat, ftp, wget, ssh.
Devices
Devices lsblk. Get-Partition, Get-Volume.
Mounting mount, umount. Mount-DiskImage, Dismount-DiskImage.
Format I sudo mkfs.fstype -I /dev/sdx -n NAME && sync Get-Disk, Clear-Disk, Set-Disk. Disable write protection.
Format II sudo mkfs.fstype -I /dev/sdxY -n NAME && sync Format-Volume.
ISO sudo dd bs=512K if=input.iso of=/dev/sdx && sync. .
Partition I sudo gdisk /dev/sdx. gdisk x: (download).
Partition II sudo gparted (sudo apt-get install gparted) (GUI) . diskmgmt (GUI).

APT

Command Explanation
sudo apt-get install ./package.deb Install a local .deb package.
sudo apt-get install package Install a package from the repository.
sudo apt-get purge package Uninstall a package from the repository.
sudo apt-get autoremove package Remove packages that are no longer needed.
sudo apt-get update Resynchronize the package index files from their sources.
sudo apt-get upgrade Install the newest versions of all packages currently installed.
sudo apt-get dist-upgrade Handle changing dependencies with new versions of packages.

Git

Command Explanation
git clone uri_repository.git Clone a repository into a new directory.
git pull Incorporates changes from a remote repository into the current branch.
git status Show the working tree status.
git add . Update the index using the current content found in the working tree.
git commit -m 'message' Record changes to the repository.
git push Update remote references (refs) along with associated objects.

Linux Containers (LXC)

Command Explanation
sudo apt-get install lxc Install LXC in Debian based distributions.
sudo lxc-create -n container_id -t download Create a container using templates.
sudo lxc-ls --fancy List the containers existing on the system.
sudo lxc-start -n container_id Run a system container
sudo lxc-info -n container_id Query information about a container.
sudo lxc-attach -n container_id Attach to a container and run a shell.
sudo lxc-stop -n container_id Shut down a container.
sudo lxc-destroy -n container_id Destroy a container.

Volver.

Curso creado por Manuel Ignacio López Quintero bajo esta licencia.