Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Last active February 28, 2017 10:55
Show Gist options
  • Select an option

  • Save joseluisq/453bcc8d45a9f40e53fc to your computer and use it in GitHub Desktop.

Select an option

Save joseluisq/453bcc8d45a9f40e53fc to your computer and use it in GitHub Desktop.
Some helpful Unix commands

Unix helpful commands

Some useful Unix commands.

List sorted files by extension

$ ls -l -X
# Or
$ ls -l --sort=extension

Create a symlink link for one directory

$ ln -s /var/www/html/ ~/www

Show your local IP

$ ifconfig | grep "inet 192."

Clear terminal history

history -c
# Or
$ rm -rf ~/.bash_history

Copy shell command output to cilpboard

$ ls -l | xclip -selection c

Copy entire directory to destination

$ cp -avr source destination
# Or
$ rsync -av source destination

Shows the full path of (shell) commands

$ which node
# /usr/bin/node

Determine the current directory

$ pwd
# /home/username/mycurrent-directory

Mount FAT32 USB device

$ mount -t vfat /dev/sdb1 /media/usb

Add a existing user to existing group

$ usermod -a -G ftp tony

Show Kernel, system and GUI version

$ uname -a && cat /etc/fedora-release && gnome-shell --version

Load latest kernel for VirtualBox

In ~/.bashrc file:

KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR

Copy remote dir to local

scp -P 123456 -r [email protected]:/user/remote/dir ./

Create one empty file in all subdirectories

echo "find . -type d -exec touch {}/.gitignore \;" | bash

Delete one file of all subdirectories

find . -name ".gitignore" -type f -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment