Unix Commands
Unix Commands
txt
cd /Benefits/DIR-A/TEST to come out from Test type cd .. enter > /Benefits/DIR-A pwd : enter-- /Benefits/DIR-A
cp
cd /FED/Benefits/mydocs
ls - swathi.txt
To create a subdirectory named mystuff in the current directory, enter: mkdir mystuff
mv rm newhw/hw1(space means TO) oldhw/firsthw swathi.txt(removes the file)
rmdir oldstuff ( removes the directory oldstuff) vi swathi.txt( creates a file if not exits vi swathi.txt( opens for edit if already exists tail swathi.txt ( by default will display the last 10 lines of a file.) tail -50 swathi.txt displays last 50 lines more displys more lines VI COMMANDS
Vi editor.
vi command launches a vi sual editor. To edit a file type vi filename vi editor is a default editor of all Unix systems. It has several modes. In order to write characters you will need to hit i to be in insert mode and then start typing. Make sure that your terminal has correct settings, vt100 emulation works good if you are logged in using pc. Once you are done typing then to be in command mode where you can write/search/ you need to
hit :w filename to write and in case you are done writing and want to exit :w! will write and exit.
options:
i for insert mode. o I inserts text at the curson o A appends text at the end of the line. o a appends text after cursor. o O open a new line of text above the curson. o o open a new line of text below the curson. : for command mode. o <escape> to invoke command mode from insert mode. o :!sh to run unix commands. o x to delete a single character. o dd to delete an entire line o ndd to delete n number of lines. o d$ to delete from cursor to end of line. o yy to copy a line to buffer. o P to paste text from buffer. o nyy copy n number of lines to buffer. o :%s/stringA/stringb /g to replace stringA with stringB in whole file. o G to go to last line in file. o 1G to go to the first line in file. o w to move forward to next word. o b to move backwards to next word. o $ to move to the end of line. o J join a line with the one below it. /string to search string in file. n to search for next occurence of string.