0nn0 / terminal-mac-cheatsheet Goto Github PK
View Code? Open in Web Editor NEWList of my most used commands and shortcuts in the terminal for Mac
List of my most used commands and shortcuts in the terminal for Mac
I seem to use chmod quite a bit.
Command | Description |
---|---|
chmod [options] mode[,mode] file1 [file2 ...] | Change the access permissions to file system objects |
chmod +x [file] | Allow file to be executed |
Allow file to be executed
chmod +x file.sh
File Contents
#!/bin/bash
printf "chmod Rocks! \n\n";
Execute file from the command line
./file.sh
Output
chmod Rocks!
I'd like to do a translation of this wiki into Latin American Spanish.
I've already started. Is this ok?
really?
I accidentally typed ⌘Cmd + L in my Mac-Terminal and it seemed to delete the output of the previous command. I'm not sure how this shortcut is defined or where I can look it up. Does anybody have an idea?
Russian translation contains some typos.
There is the PR to fix them: #77
Consider adding chown
Command | Description |
---|---|
chown [options] [user] [file/folder] | Change the owner of a file |
chown -f -R [user] [folder] | Change the owner of a folder and files recursively |
chown -f apache filename.txt
sudo chown -f -R user:group /dir
Consider adding Conditionals
if [ conditional expression1 ]
then
#statement1
#statement2
else
if [ conditional expression2 ]
then
#statement3
fi
fi
#!/bin/bash
count=99
if [ $count -eq 100 ]
then
echo "Count is 100"
elif [ $count -gt 100 ]
then
echo "Count is greater than 100"
else
echo "Count is less than 100"
fi
# OR example
if [[ "$repl_IO" != "Yes" -o "$repl_SQL" != "Yes" ]] ; then
Command | Description |
---|---|
Apropos [search-pattern] | Searches for command with keywords in description |
I think this command is essential for finding new terminal commands. It really opens the user up to new options. It's especially useful with either -h or man [command] to look around for something that can fulfill a specific task
Hi, this repo is great, serving as a good reference.
Can you add flow control tips?
command && command
command || command
&
(what's the difference?)Thanks
Consider adding grep
Command | Description |
---|---|
grep [search_pattern] [file] | Search for all lines that contain the pattern |
grep -v [search_pattern] [file] | Search for all lines that do not contain the pattern |
[string] | grep [search_pattern] |
Contents of filename.txt
a/b/c
a/b/c.zip
Search File Contents
# find all lines that contain "a/b/c"
grep "a/b/c" filename.txt
# find all lines that contain "a/b/c" or print if none are found.
grep "a/b/c" filename.txt || printf "\nNo Matches Found.\n"
# find all lines that contain "a/b/c" and do not include ".zip"
grep "a/b/c" filename.txt | grep -v ".zip"
Search Command History
# find all lines in bash history that contain the search_pattern
history | grep search_pattern
I will do the translation of the Wiki that was created for you.
I will do the translation into Portuguese of Brazil.
grep -r [search_pattern] [file] Recursively search for all lines that do not contain the pattern
should be
lines that contain the pattern
Seems like in the description you meant 'file' instead of 'fi'.
https://github.com/0nn0/terminal-mac-cheatsheet/wiki/Terminal-Cheatsheet-for-Mac-(-basics-)
Command | Description |
---|---|
< | Tell command to read content from a fi |
Command | Description |
---|---|
[command] ; [command] | Separate multiple commands with ; |
echo run; echo multiple; echo commands; echo from; echo one; echo line
if [ "a" == "a" ] ; then echo "true" ; fi
Hi,
I don't know if I'm the right place but here is what I'm trying to do.
Goal: Open an app from any mac using a flash drive.
I'm trying to run an app (QT Wallet app) from my flashdrive, this app requires to have information from it's library folder.
The app itself does not give me the option to re route the library folder thats also on the flashdrive.
Is possible to use terminal? Or perhaps use alias in this case?
Thank you!
I have some .bashrc & .bash_prfile commands, but none that affect bindings if that's even possible. And my Terminal preferences aren't doing anything crazy. So why won't several of these commands work for me?
Any ideas?
Command | Description |
---|---|
[variable]=[value] | Set variable equal to value |
[command] $[variable] | Use variable's value by adding $ before the name |
x=12345
echo $x
timestamp=`date +%Y-%m-%d`
echo $timestamp;
hello=hello;
world=world;
echo $hello $world
great site by the way!!
say -v [[slnc XXX]]
-v '?' shows all voices available
XXX pause duration
Test
windows cheatsheet?
It just shows: [D[D[D[D[D when I press option and ->
Thank you for your work I appreciate been looking for a quick refresher on the key commands. And to all of those whose key commands were having issues. If a CMD'let is not working properly or to your specific requirements then altering the command individually is always an option and updating the profile with the custom cmdlets. Or you could begin to understand the light shinning behind the darkness and begin researching Darwin Series in MAC and why it was discontinued. Then maybe you can understand why things in our lives have stopped be so reliant on our personal control and we now have assistance wether we ask for it or not. ::Only after one opens their mind to the realm of possibilities;; then one can begin to open their mouth and say::: MOO!!!!!!!
Command | Description |
---|---|
tar -zcvf [.tgz-file] [files] | Zip files with gzip compression |
tar -jcvf [.tbz2-file] [files] | Zip files with bzip2 compression |
gzip -f -9 [file] | Zip file |
tar -zxvf [.tgz-file] | Decompress file |
tar -jxvf [.tbz2-file] | Decompress file |
Compress
timestamp=`date +%Y-%m-%d`
tar -zcvf archive.$timestamp.tar.gz myFolder
tar -zcvf data.tgz *.doc
tar -zcvf pics.tar.gz *.jpg *.png
tar -jcvf data.tbz2 *.doc
ls -l
gzip mydata.doc
gzip *.jpg
ls -l
bzip2 mydata.doc
bzip2 *.jpg
ls -l
zip mydata.zip mydata.doc
zip data.zip *.doc
ls -l
Decompress
tar -zxvf data.tgz
tar -zxvf pics.tar.gz *.jpg
tar -jxvf data.tbz2
gzip -d mydata.doc.gz
gunzip mydata.doc.gz
bzip2 -d mydata.doc.bz2
gunzip mydata.doc.bz2
unzip file.zip
unzip data.zip resume.doc
Links
It seems that at least since macOS Sierra Option + →
and Option + ←
are equivalent to ESC then F
and ESC then B
.
Since they are easier to use it may be worth documenting them as well.
While it is true that Ctrl + D will exit the current shell when no process is running, it is useful to know that you can send EOF to a the running process with Ctrl + D as well.
For example:
cat
I think is in portuguese
Consider adding pbcopy, pbpaste
Command | Description |
---|---|
pbcopy < [file] | Copies file contents to clipboard |
pbpaste | Paste clipboard contents |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.