Shell Commands
Each shell has its own set of commands that it understands, but they all follow the same general format. Commands are broken into words (separated by spaces) with the first word being the command or program to run, and subsequent words being passed to the program as arguments for it to use.
Run as admin (sudo
)
Operating systems restrict some actions to admin users, particularly when the actions will change the behaviour of the system. In Unix, you can use the sudo
shell command to get the superuser to do something. You follow the sudo
command with the details of the command you want to do.
Example
The following are some example shell commands. Lines starting with a #
are comments, so these are ignored by the shell program. We use them here to explain how each shell command is structured.
Note: These commands are not expected to be used directly all together (copied and pasted), but rather as information to explain the commands shown, or using individual sections.
# the ls command with flags -l -h and -als -l -h -a
# shorthand for the above, with -lhals -lha
# cd command, with a folder path as an argumentcd /Users/andrew/Documents/Code
# mkdir command with Project1 as an argumentmkdir Project1
# dotnet program with 2 arguments: new and consoledotnet new console
# dotnet program with 3 arguments: add, package, and splashkitdotnet add package splashkit
# clang++ program with 5 arguments: test.cpp, -o, test, -l, SplashKit# -o and test are linked (test is the value for the -o option)# -l and splashkit are linked (splashkit is the value for this -l)clang++ test.cpp -o test -l SplashKit
# the ls command with flags -l -h and -als -l -h -a
# shorthand for the above, with -lhals -lha
# cd command, with a folder path as an argumentcd /home/andrew/Documents/Code
# mkdir command with Project1 as an argumentmkdir Project1
# dotnet program with 2 arguments: new and consoledotnet new console
# dotnet program with 3 arguments: add, package, and splashkitdotnet add package splashkit
# clang++ program with 5 arguments: test.cpp, -o, test, -l, SplashKit# -o and test are linked (test is the value for the -o option)# -l and splashkit are linked (splashkit is the value for this -l)clang++ test.cpp -o test -l SplashKit
# the ls command with flags -l -h and -als -l -h -a
# shorthand for the above, with -lhals -lha
# cd command, with a folder path as an argumentcd /c/Users/andrew/Documents/Code
# mkdir command with Project1 as an argumentmkdir Project1
# dotnet program with 2 arguments: new and consoledotnet new console
# dotnet program with 3 arguments: add, package, and splashkitdotnet add package splashkit
# clang++ program with 5 arguments: test.cpp, -o, test, -l, SplashKit# -o and test are linked (test is the value for the -o option)# -l and splashkit are linked (splashkit is the value for this -l)clang++ test.cpp -o test -l SplashKit