User Tools

Site Tools


notes:unix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:unix [2018/11/15 21:42] – [Other] sdiarranotes:unix [2020/11/04 23:50] (current) – Changed hyperlink to secure variant smalik3
Line 5: Line 5:
 </WRAP> </WRAP>
  
-======Projects======+======Course Notes======
  
-======URLs====== +The "man" command can be used on Linux to display the manual of an inputted command. To use this command type "man" followed by a space and then a Linux command. 
-**Linux Kernel-Repo (Linus Torvalds)** +Example: <code>man cd</code> 
-https://github.com/torvalds/linux +This will display the manual for the Linux command "cd". This is very useful for starting off understanding Linux commands. And when in more doubt [[https://www.google.com|Google]] or asking questions to your professor is the answer.
-======Notes====== +
-------- +
-I feel like there should be some beautiful words of knowledge contained on this page, so I have decided to do my best attempt at making it that way+
  
-===Vim/Vi Command Mode Commands===+----------------------------------
  
-- Escape key leads to command mode+The "cd" command is useful for going into directories or folders. 
 +Example: <code>cd</code> 
 +After using "cd" you add the option if which directory/folder you want to go into. Such as "cd familyphotos", you can even get to directories not close to the one you're in like "cd ~/games/somegame/unrelated".
  
-'i' leads to insert mode at the current space. +----------------------------------
-  +
-Navigation is accomplished through h (right), j (down), k (up), l (left).+
  
-- 'a' leads to insertion mode at the next space+The "mkdir" command is useful for creating folders. 
 +Example: <code>mkdir</code> 
 +After using "mkdir" you add the name of the folder. For example "mkdir folder" will create folder named "folder" in whatever directory you are in. You can also use full paths like "mkdir ~/classes/unix" to create a folder that may not be in the same directory as you.
  
-- 'I' leads to insert mode at the beginning of the line. 
- 
-- 'A' leads to insert mode at the end of the line. 
- 
-- 'o' leads to insert mode on a new line after the current line. 
- 
-- 'O' leads to insert mode on a new line before the current line. 
- 
-- 'w' is move forward a word (stop not just at spaces, but also / . , ? and more). 
- 
-- 'b' is move back a word (same as above).  
- 
-- 'W' and 'B' move forward and backward a word (only stop at spaces). 
- 
-- '.' repeats the last command. 
- 
-- '^' and '$' take you to the beginning and end of lines respectively without going into insert mode.  
- 
-- '{' and '}' take you to the previous and next paragraphs. [Side Note: many of these commands can be prefixed  
-with a number, which means you want the command to be executed that many times]. 
- 
-- 'x' deletes the next character. 
- 
-- 'X' is cutting (acts like backspace). 
- 
-- You can also do commands like dw, db, d^, d$, d{, d}, dd which do a delete operation related to the letter after the 'd' (dd deletes the current line). 
- 
-- 'v' allows you to highlight text by moving around with the arrow keys. 
- 
-- 'y' is yank (essentially just 'copy'). There must be text highlighted for this to work.  
- 
-- 'p' pastes below and 'P' pastes above. 
- 
-------- 
-<color #ed1c24>Regular expressions</color>  
- 
-In a sort of a related note, as vi uses some regular expressions patterns, this section will cover regular expressions and pattern matching. In Unix regular expressions are used to give a user/admin the capability to search based on patterns. Regular expressions, or regex, or regexp is a very useful tool. The common patterns are the followings: 
- 
-- '.' --> indicates match every characters 
- 
-- '^' --> match the beginning of a string or file(As in Vi)  
- 
-- '$' --> match the end of a line of file(As in Vi) 
- 
-- '[a-zA-Z]' --> match all letters uppercase and lowercase  
- 
-- '[0-9]' --> match only digits from 0-9  
- 
-- '[0-9]*' --> match 0 or more digits  
- 
-- '[0-9]+' --> match 1 or more digits  
- 
-- '[a-d]?' --> match 0 or only one occurrence of a-d lowercase  
- 
-- '[0-9]{x, y}' --> match digits at least x times, and less than y times 
- 
-*These are few common patterns in regex. 
-======Other====== 
-------- 
-<color #ed1c24>Quick Tip: </color> 
- 
-Recently I have discovered a trick that could help run scripts much quicker with direct access to one's lab46 account, without working only on a single a single. Ultimately, I had to ssh into my account, and whenever I left the terminal open for a few minutes, it would go offline - or had share scripts between my personal laptop and lab46 machines, and work on projects on one machine at a time(fairly painful). With this method one can easily call commands anywhere, that are otherwise only available on the lab46 account. Here is how it is accomplished:  
-<code> 
-    ssh account@lab47.corning-cc.edu command_here 
-</code> 
-A working example would be the following: 
-<code> 
-     #From my own laptop 
-     current_grades=$(ssh user@lab46.corning-cc.edu status unix) 
-      
-     #This example would return grades from the user. 
- 
-</code> 
-**Note that the script would prompt you to enter your <color #ed1c24>password</color>.** 
notes/unix.1542336156.txt.gz · Last modified: 2018/11/15 21:42 by sdiarra