Skip to content

sarnobat/unix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 

Repository files navigation

See also

unix

Command line tips and tricks for beginners

Quick start

Video

Working directory

pwd

Open folder

open .

Create folder

mkdir test
mkdir mydir/subdir

Go back to previous folder

cd -

Tab completion

For changing directory more quickly

cd my<tab>/su<tab>/

Symbolic links

ln -s ~/mydir/subdir

Prompt

To get more idea where you are

  • host
  • working directory
  • user
PS1='\w > 

Aliases

alias l="ls -lrt"

Key bindings

For quickly executing repetitive commands

Terminal.app:

  • Preferences
  • Profiles
  • Keyboard
  • Use Option as Meta Key
bind ' "\el":"ls -lrt\n"'

find

Pipes

find | grep Cache

xargs

find | grep Cache | xargs grep --color powermock

Regular expressions

find -iname "*.java" | sed -e 's/.*src.\(.*\).java/\1/' | sed -e 's/\//./g'

Move cursor backwards and forwards

This comes automatically with Terminal.app

Alt-left

Redirect output

find -iname "*.java" | sed -e 's/.*src.\(.*\).java/\1/' | sed -e 's/\//./g' > out.txt

Others

HTTP file server

Check what process is listening on a port

sudo lsof -i:80

Processes

ps aux

Kill a process

Netcat

Popup box

osascript -e 'display dialog "Built"'

Run multiple commands

;
&&
ls ~/non-existed-file && echo "file exists" || echo "file does not exist"

Disk space

Disk space consumption

History

machine info

SSH passwordless

rsync

Copy large files with progress indication, across a network, and preserve original timestamps.

rsync 

Scripting

~/bin/

Vim

vim
  • Syntax highlighting

Cron

crontab -e

Install new software

Tail a log file

tail

Jar file inspection

unzip

expect

expect

awk

awk
uname -a

About

Command line tips and tricks for beginners

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages