Skip to content

Useful command shortcuts to make your life easier 42 zshrc

Notifications You must be signed in to change notification settings

zstenger93/zshrc_aliases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

55 Commits
Β 
Β 

Repository files navigation

πŸ“– 42 & GIT ZSHRC CHEATSHEET FOR BEGINNERS

Menu

Norm

Git

Make

Basic

Valgrind

Open Links/Folders

πŸ“‹ How alias works:

user-defined shortcut for a command or set of commands you can invoke like any other command.

The basic syntax for defining an alias is as follows:

alias (name of the alias)='(the command/s you want to assign to the alias)' RTFM

πŸ’‘ ZSHRC Themes via:

If you want more than this have a look up on their 200+ plugins

A few example:

alias-finder

Which if the typed command is in an alias, it will show you. Get used to aliases esier

common-aliases

Link to the rest 200+ plguins

https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins

πŸ› οΈ Aliases I use:

Norm

alias n='norminette'

Grep only the number of norm errors

alias n='n | grep Error: |  wc -l'

Grep only the error lines with their location

alias n='n | grep Error'

Git

Git clone the repo on my clipboard

c() {
	local copied_text
	copied_text=$(pbpaste)
	git clone $copied_text
}

Git add all and commit

alias ga='git add . && git commit -m'

Git diff

alias gd='git diff'

Git push

alias gp='git push'

Git status

alias gs='git status'

Git pull

alias p='git pull'

Add my libft as a git submodule (change it to yours..)

alias gsa='git submodule add https://github.com/zstenger93/libft.git'

Git commit history

alias gl='git log'

Git commit history short

alias glo='git log --oneline'

Git commit history with changes shown in the commits

alias gld='git log -p'

Git checkout

alias gco='git checkout'

Make

Make

alias m='make'

Make bonus

alias mb='make bonus'

Make clean

alias mc='make clean'

make fclean

alias mf='make fclean'

make re

alias mr='make re'

Open links or folders

Open my github profile (change it to yours..)

alias gh='open https://github.com/zstenger93'

Open my intra profile

alias i='open https://profile.intra.42.fr/'

If you need a directory a lot of times for some reason

alias (name of the alias)='open (path to folder)'

Basic

Type "tco filename" to create and open a c file, you can change it to whatever. I have it for .c .h and Makefile

tco() {
  touch "$1.c"
  open -a Visual\ Studio\ Code "$1.c"
}

Type "tc filename" to create a c file, same as the previous without opening it

tc() {
  touch "$1.c"
}

Touch

alias t='touch'

To edit my aliases:

alias z='vi ~/.zshrc'

chmod

alias ch='chmod +x'

Move back one folder

alias .='cd ..'

If you move to a specific directory many times you can try this: cd to root and the path to the dirctory

alias name='cd / && cd path/to/directory'

AFK - Screen Lock

alias a='pmset displaysleepnow'

Brew install

alias b='brew install'

Valgrind

Valgrind

alias v='valgrind'

Valgrind memcheck

alias vmem='valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --error-limit=no --tool=memcheck'

πŸ”