Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Publication Station
Search
Editing
Text Images
(section)
From Publication Station
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Essential commands=== For a PDF with Unix/Linux Command Reference - download the following [https://files.fosswire.com/2007/08/fwunixref.pdf link] ==== System Info ==== '''date''' β Show the current date and time<br /> '''cal''' β Show this month's calendar<br /> '''uptime''' β Show current uptime<br /> '''w''' β Display who is online<br /> '''whoami''' β Who you are logged in as<br /> '''finger ''user''''' β Display information about '''''user'''''<br /> '''uname -a''' β Show kernel information<br /> '''cat /proc/cpuinfo''' β CPU information<br /> '''cat /proc/meminfo''' β Memory information<br /> '''df''' '''-h''' β Show disk usage<br /> '''du''' β Show directory space usage<br /> '''free''' β Show memory and swap usage ==== Keyboard Shortcuts ==== '''Enter''' β Run the command<br /> '''Up Arrow''' β Show the previous command<br /> '''Ctrl + R''' β Allows you to type a part of the command you're looking for and finds it '''Ctrl + Z''' β Stops the current command, resume with '''fg''' in the foreground or '''bg''' in the background<br /> '''Ctrl + C''' β Halts the current command, cancel the current operation and/or start with a fresh new line<br /> '''Ctrl + L''' β Clear the screen '''''command'' | less''' β Allows the scrolling of the bash command window using '''Shift + Up Arrow''' and '''Shift + Down Arrow'''<br /> '''!!''' β Repeats the last command<br /> '''''command ''''' '''!$''' β Repeats the last argument of the previous command<br /> '''Esc + . (a period)''' β Insert the last argument of the previous command on the fly, which enables you to edit it before executing the command '''Ctrl + A''' β Return to the start of the command you're typing<br /> '''Ctrl + E''' β Go to the end of the command you're typing<br /> '''Ctrl + U''' β Cut everything before the cursor to a special clipboard, erases the whole line<br /> '''Ctrl + K''' β Cut everything after the cursor to a special clipboard<br /> '''Ctrl + Y''' β Paste from the special clipboard that '''Ctrl + U''' and '''Ctrl + K''' save their data to<br /> '''Ctrl + T''' β Swap the two characters before the cursor (you can actually use this to transport a character from the left to the right, try it!)<br /> '''Ctrl + W''' β Delete the word / argument left of the cursor in the current line '''Ctrl + D''' β Log out of current session, similar to '''exit''' ==== Learn more about Commands/programs ==== '''apropos''' '''''subject''''' β List manual pages for '''''subject'''''<br /> '''man -k ''keyword''''' β Display man pages containing '''''keyword'''''<br /> '''man ''command''''' β Show the manual for '''''command'''''<br /> '''man -t ''man'' | ps2pdf - > ''man.pdf''''' β Make a pdf of a manual page<br /> '''which''' '''''command''''' β Show full path name of '''''command'''''<br /> '''time ''command''''' β See how long a '''''command''''' takes '''whereis ''app''''' β Show possible locations of '''''app'''''<br /> '''which ''app''''' β Show which '''''app''''' will be run by default; it shows the full path ==== File Commands ==== '''ls''' β Directory listing<br /> '''ls -l''' β List files in current directory using long format<br /> '''ls -laC''' β List all files in current directory in long format and display in columns<br /> '''ls -F''' β List files in current directory and indicate the file type<br /> '''ls -al''' β Formatted listing with hidden files '''cd ''dir''''' β Change directory to '''''dir'''''<br /> '''cd''' β Change to home<br /> '''mkdir''' '''''dir''''' β Create a directory '''''dir'''''<br /> '''pwd''' β Show current directory '''rm ''name''''' β Remove a file or directory called '''''name'''''<br /> '''rm''' '''''-r dir''''' β Delete directory '''''dir'''''<br /> '''rm -f ''file''''' β Force remove '''''file'''''<br /> '''rm -rf ''dir''''' β Force remove an entire directory '''''dir''''' and all itβs included files and subdirectories (use with extreme caution) '''cp ''file1 file2''''' β Copy '''''file1''''' to '''''file2'''''<br /> '''cp -r ''dir1 dir2''''' β Copy '''''dir1''''' to '''''dir2'''''; create '''''dir2''''' if it doesn't exist<br /> '''cp ''file'' /home/''dirname''''' β Copy the filename called '''''file''''' to the '''/home/dirname''' directory '''mv ''file'' /home/''dirname''''' β Move the '''''file''''' called filename to the '''''/home/dirname''''' directory<br /> '''mv''' '''''file1 file2''''' β Rename or move '''''file1''''' to '''''file2'''''; if '''''file2''''' is an existing directory, moves '''''file1''''' into directory '''''file2''''' '''more ''file''''' β Display the file called '''''file''''' one page at a time, proceed to next page using the spacebar<br /> '''head ''file''''' β Output the first 10 lines of '''''file'''''<br /> '''head -20 ''file''''' β Display the first 20 lines of the file called '''''file'''''<br /> '''tail ''file''''' β Output the last 10 lines of '''''file'''''<br /> '''tail -20 ''file''''' β Display the last 20 lines of the file called '''''file'''''<br /> '''tail -f ''file''''' β Output the contents of '''''file''''' as it grows, starting with the last 10 lines ==== SSH ==== '''ssh ''user''@''host''''' β Connect to '''''host''''' as '''''user'''''<br /> '''ssh -p ''port user''@''host''''' β Connect to '''''host''''' on port '''''port''''' as '''''user'''''<br /> '''ssh-copy-id ''user''@''host''''' β Add your key to '''''host''''' for '''''user''''' to enable a keyed or passwordless login ==== meta characters ==== Meta Characters are characters that have special meaning within the terminal * <code>~</code> the tilde stands for the user's home. <code>cd ~/</code> change directory to home * <code>.</code> dot stands for '''this''' directory. <code>ls .</code> list this directory * <code>..</code> dot dot stands for '''the parent directory''' to this directory. <code>cp myfile.jpg ..</code> copy myfile.jpg to the parent directory * <code>*</code> asterisk is a wildcards which represents zero or more characters <code>ls P*.jpg</code> will list all the files, in the current directory, that begin with P and end with .jpg * <code>\</code> backslash it is a literal character. It escape the meta value of the meta-characters and display them only as literal characters. <code>echo Foo \*</code> will output <code>Foo *</code> If \ wasn't there it would output all the files in that directory. ==== pipes, write to & append ==== '''A pipes (" | ") sends the output of one program to the input of another program'''. <code>echo "my sentence"| wc</code> the echoed sentence "my sentence" is ''pipped'' into the program wc which counts the number of lines, words, and characters <code>></code> Writes the output of a command to a file, rather than to print on terminal. <code>df > df_output.txt </code> redirect the content of <code> man dfM </code> to a file called df_output.txt If the said file doesn't exit it will create it, if it already exists it will overwrite its contents/ <code>>></code> appends the output of a command to a file, without overwriting the original file. <code> echo 'also add this' >> df_output.txt </code> will add 'also add this' to the contents of df_output.txt
Summary:
Please note that all contributions to Publication Station are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Publication Station:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Main navigation
Main page
Printmaking Studio
Print Studio
Dig. Publishing Studio
Namespaces
Grafiwiki
Random Page
Log in
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs