Skip to content

Instantly share code, notes, and snippets.

@cortesben
Last active July 31, 2024 18:45
Show Gist options
  • Save cortesben/c28d9d8b6ca16688e15c to your computer and use it in GitHub Desktop.
Save cortesben/c28d9d8b6ca16688e15c to your computer and use it in GitHub Desktop.
Bash commands and Angular CLI commands

#Angular-cli oh shit!

https://cli.angular.io/reference.pdf

Commands Description
ng help returns all commands with flags they can take as a param
ng new [project-name] create a brand new angular project with live server BANG!
ng init grabs name from folder that already exist
ng build builds the production version of project
ng build -prod --aot builds and gzips file and should do tree shaking
ng serve creates the local version of project with live reload server
ng serve -p 8080 serve with different port number
ng github-pages:deploy push site to gitHub pages
ng lint lints files in project
ng generate takes the arguments below
ng g component my-new-component Component
ng g directive my-new-directive Directive
ng g pipe my-new-pipe Pipe
ng g service my-new-service Service
ng g class my-new-class Class
ng g interface my-new-interface Interface
ng g enum my-new-enum Enum
ng g module my-module Module

#Bash Terminal Commands Bash is a "Unix shell": A command-line interface (CLI) for ineracting with the operating system. http://explainshell.com

#Learn shell scripting http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

Commands Description
chsh -s /bin/bash change terminal to bash
chsh -s /usr/bin/zsh change terminal to zsh
echo $0 see type of shell running
bash --version bash version running
curl -O www.me.com downloads file from Link
dscl . list /dir/location/path | grep -v "^_" list all users on this Mac
sudo chown -R username /dir/location/path change all permissions recursively
find . -name 'mystring*' find a file
find /dir/location/path -type d -name "99966" -print find a directory :-type d means "Directory"
grep -lr "text to find" /dir/location/path find string in file
ps aux | grep node find all node process running
source ~/.bash_profile save bash changes
top shows all running programes CPU cycle
ps -acx find all programs running on Machine
ps -A Show all process running
ps -ax | head -20 a: option shows process for all users x: shows process not connected with a Terminal
ps kill 1234 number used to kill application running
cd go to directory or return to home director if you /file/file/ is listed
ls -a show all files in directory
cd ~ or cd /dir/location/path go to home directory
open filename.css open a file
open . opens dictory in finder
cp copy file
mv filename dir-name move file into a directory
mv oldname newname rename a file
rm delete file (does not go to trash, just goes away for ever)
pwd shows what directory your in
man ls shows documentation for command must us q to escape command
sw_vers -productVersion shows product version running
mkdir /dir/location/path Makes a directory
touch new_file.html create a new file
xattr -rc "/path/to/directory" To recursively remove extended attributes on all files in a directory
du -sh / | du -sh /path/to/dir// Show all the directories in current folder
chmod +x myfile make file executible
chmod +r myfile make file readable
chmod +w myfile make file writable
chmod g+w myfile give group write permission to "myfile", leaving all other permission flags alone
chmod g-rw myfile remove read and write access to "myfile", leaving all other permission flags alone
chmod g+rwxs /dir/location/path give full group read/write access to directory "mydir", also setting the set-groupID flag so that directories created inside it inherit the group
chmod u=rw,go= privatefile explicitly give user read/write access, and revoke all group and other access, to file 'privatefile'
chmod -R g+rw give group read write access to this directory, and everything inside of it (-R = recursive)
chgrp -R medi . change the ownership of this directory to group 'medi' and everything inside of it (-R = recursive). The person issuing this command must own all the files or it will fail.
ipconfig getifaddr en0 local address on ethernet
ipconfig getifaddr en1 local address on wifi
ifconfig local address
netstat -i ip addresses assigned to interfaces
netstat ip addresses http://pcsupport.about.com/od/commandlinereference/p/netstat-command.htm
delete all trash sudo rm -rf ~/.Trash/*
ln -s | ln -s /dir/location/path ~/SymlinkDirectory Create a symlink command takes target location “/Usr/Directory/Destination/” and creates the link file inside of “~/SymlinkDirectory”
Commands Description
uname name of kernel
uname -r kernel version number
clear clear the screen
read someinfo lets you prompt for input on the terminal then you can use as $someinfo in your script

| denotes comment lines or tell the machine how to interpit the shell

@santosh01357
Copy link

Superb, so helpful!

@tadakoglu
Copy link

To create a library inside the new-app;

ng new new-app
cd new-app
ng generate library my-lib

Compile the library after creation to reference it

cd new-app
ng build my-lib

Delete the dist (compilation folder)

cd new-app
rm -r dist

Create new app inside the app and add routing support to it

cd my-app
ng generate application sub-app --routing  

To stop Node Server if you get "XXX port is already being used" error by compiler
Hold and press : CTRL + C in the terminal.
it's will ask yes or no to stop batch job. (Y/N) or (Yes/No)
Type Y and Press Enter

@Mohit-182000
Copy link

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment