loading...


23 moste basic terminal commands

The Most Basic Terminal Commands for Unix based systems

Wath is Terminal?

Terminal is a terminal emulator to interact with the operatings system api. Terminal is designed for you to typing in specific commands. Here we listed some very basic commands you must know. These commands are very useful for your daily Unix Adventures.

Login as Root

  sudo

Change root password

  sudo passwd root

Change directories

 cd <directory>

  if you have a space in the file / folder name use quotes

  cd /volumes/”Linux rocx”

Remove a file

rm <filename>

Copy a file

  cp <filename> <name_of_copy>
         Example: cp something.txt somethingelse.txt

Move a file

mv <filename> <destination>

Find a file

locate <filename>

Find a binary file

  whereis <binary file>

Create a folder

  mkdir <name_of_folder>

Move a folder

  mv folder /applications

Repair Permissions of a folder

 chmod -R 755 <path>  
  chown root:wheel <path>

List Files in a directory

 ls

Show manual

man

remove a file, example: rm somefile to remove a directory you may need the -R option, you can also use the -f option which tells it not to confirm each file: rm -Rf /dir

rm

concatenate, or output a file

cat

outputs one page of a file and pauses. example: more /var/log/messages press q to exit.

more

secure copy, copies a file over SSH to another server. example: scp /local/file user@host.com:/path/to/save/file

scp

tape archiver, tar takes a bunch of files, and munges them into one .tar file, the files are often compressed with the gzip algorithm, and use the .tar.gz extension. to create a tar tar -cf archive.tar /directory, then to extract the archive to the current directory run tar -xf archive.tar to use gzip, just add a z to the options, to create a tar.gz: tar -czf archive.tar.gz /dir to extract it tar -xzf archive.tar.gz

tar

lists files and directories recursively on a single line.

find <name_of_folder>

prints the last few lines of a file, this is handy for checking log files tail /var/log/messages if you need see more lines, use the -n option, tail -n 50 /var/log/messages you can also use the -f option, which will continuously show you the end of the file as things are added to it (very handy for watching logs) tail -f /var/log/messages

tail <path_to_file>

prints the first few lines the file

head <path_to_file>

Text editor

nano <path_to_file>