Skip to Content

Basic SSH and UNIX Commands

Navigation Commands

ls this is the list command, it will list the content of the current directory
ls -alh this lists all files and folders + permissions and sizes in a readable format
cd this is the change directory command used in conjunection with a folder name like this: cd users/foo/ this would take to to the foo directory
cd .. this cd command will bring you back one directory in the path
cd ~ this cd command will take you to your home or top directory
mv this is the move command mv foo/ /path/to/new/loc

File Commands

touch will create a file touch example.txt
pico will open a file in a basic text editor pico example.txt
vi another basic txt editor vi example.txt
more will allow you to view the file without the ability of editing more example.txt
mkdir will create a directory mkdir foo creates a folder called foo
mkdir foo\otherfoo\morefoo this will make the directory foo with two sub directories
rm will delete a file rm example.txt
rm -rf will delete a folder and all subfolders beneath it rm -rf foo/
df gives physical disk usage report with % used
du lists all files and folder sizes - this takes awhile
du -sh this lists all the subfolders + sizes in a directory
wget archive a website wget -m http://whateverurl
ls -l | grep ^d lists all the sub directories
alias lsd="ls -l | grep ^d" this creates the alias lsd of ls -l | grep ^d so you can use it more efficiently. You may have to sudo this.

Tar / Compression Commands

  • tar -cvzf file.tar.gz inputfile1 inputfile2
  • - this will combine two files together
    tar -cvzf foo.tar.gz /path/to/folder/2/compress/ - this creates a tar.gz of a dir
    tar tvf foo.tar - List all files in foo.tar.

    No Responses to “Basic SSH and UNIX Commands” Leave a reply ›

    Leave a Reply

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>