Console Flashcards
show files in the current directory
ls (name: list. list files)
ls - additional commands
- l (prints long form of file list)
- a (show all files, including hidden files)
ls - l
prints long form of file list drwxrwxr-x r: read w: write x: execute
- first rwx - permissions of the creator
- second rex - permissions of a group
- last r-x - permission for everyone else
what a folder is called in a console
directory
show you your current directory
pwd - print working directory
shortcut to home directory
~ (tilda)
move to a different directory
cd - change directory
you don’t need start with a / if you are moving to relative directory from where you currently are.
if you do an absolute path, you have to start with /user…
move up a directory level
cd ..
to move two levels up: cd ../..
a program that displays the content of a file
less
need to hit the “q” key to exit out of the less program
prints the contents of one or more files to the console
cat
a simple text editor in the console
nano
shortcuts use the ^ which is actually the control button
how to move or rename a file or directory
mv (move)
takes two arguments:
1) what do we want to move
2) where we want to move it
Renaming:
$ mv hello.txt hi.txt (this is same as renaming it)
Moving directories:
$ mv hi.txt documents/
(this is moving it because documents is a directory)
represents our current directory
.
(dot)
$ mv documents/hi.txt .
this would move it up one directory (my current directory)
copies a file or directory
cp
works the same as move -
1) what do we want to copy
2) where we want to copy it to?
for copying a directory though you have to use -r (recursive) which will copy of the document within the directory as well. example:
$ cp -r documents docs
(this will copy the documents folder and call it docs (with all of the
removes files or directories
rm
be careful of using remove because there is no going back in console.
you can’t remove a directory without an -r just like copy because you need to recursively remove all of the files and sub-directories in within the directory as well
how to create a directory (including nested directories)
mkdir
(make directory)
to create nested directories
use the -p documents/notes/console/part1 (the -p allows us to create as many sub directories as needed)
repository
a collection of all the different versions and files of a project
committing
git commit
other commit commands:
git commit -a -m
a - means that all changes to the files in the repository will be committed.
m - means that you can add the commit description message directly to the commit command
when you tell the version control system that you are done with a version and ready for the next
create a repository
git init [name of project]
how to add a file to the repository so that i can be tracked
git add [file name to be added to the repository]
you can also use “git .” which will stage all changes to the files in that directory.