Wednesday, July 25, 2012

Trinary Dwarfs-Setting up Directories



Introduction to Unix

Open up a terminal window, this will vary depending on what 
system you are in, X11 is common for modern macs. From here 
you are able to navigate about your own personal files and 
among the server your in. The following are some common 
commands that will make it easy to set up your files.
Of particular use is tabbing. Pressing tab can be used to 
autocomplete an entry. For example given a directory name, 
e.g. echelle_33 typing e tab if that is the only file in 
your directory that starts with an e, it will autocomplete 
the command to echelle_33, autocompletion makes going to
different directories easier.

ls --- lists files in directory
ls -l --- lists your files in with additional information, 
size of the file, who owns the file and who has the right to 
look at it and/or modify it, and when it was last modified. 
The categories in which rights are given are your terminal, 
those on the same server and the world.
ls -a --- lists all files, including the ones whose filenames 
begin in a dot, which you do not always want to see. In 
particular swap files designate files which are in use. This 
is a temporary storage for data. When files are closed incorrectly 
these files can sometimes be used to retrieve data, however they 
can also cause some issues when opening files
emacs filename this is a common text editor to let you create 
files, filename can includes suffixes such as .txt, .in, etc. 
Your system may or may not include this but most likely will.
mv filename_1 filename_2 this moves a file into a different 
directory or can be used to rename a file. This is especially 
useful for renaming the type of file.
rm filename this is used to remove a file, there are additions 
you can add to this in particular rm -f is a force remove
rmdir directoryname this can be used to remove a directory, 
a common addition is rmdir -rf which recursively force removes 
a directory.
diff filename_1 filename_2 this is used to find the 
differences in the text of the two files.
cd directoryname  this allows you to go to a directory 
within the one that you are in. If you do instead cd .. this 
allows you to go up one directory, you can also do cd /filepath 
in order to go to a completely new directory
mkdir directoryname this allows you to create a new 
directory/folder with the given name
vi this is another common text editor, in most systems. This 
can be used alternative to emacs. vim is a more powerful 
version of vi. vi filename creates a text file with name 
filename
tkdiff this is another common checker, it is a gui that
actively shows and highlights the differences between two
text files and shows them side by side matched by lines.
cat filename filename filename ... > newfile is a very
useful command that can be used to combine multiple
textfiles into one.
find -name \*.txt > list.txt
prints all txt files with filepath into list.txt file.
find . -name '*' -print|xargs grep 'text to search' finds filename that contains text you wanted to find

No comments:

Post a Comment