Create:
- File: touch filename, this will create an empty file. Alternatively, use your favourite text editor.
- Directory: mkdir directoryname this will create an empty directory. I like the -p switch, as this will create the entire path for you in one neat command, e.g. mkdir -p /firstdir/seconddir/thirddir
- File: rm filename. There are many switches for rm, I tend to use rm -f filename so that I don't get prompted every time. Use with care though, particularly when deleting directories.
- Directory: rmdir directoryname if directory is empty. rm -r directoryname if it isn't. You can add the -f switch to delete without being prompted
- File: cp myfile mydir/ There are a myriad of options for cp. You can have a look at them with cp --help or better still have a look at the man page man cp.
- Diretory: cp -r sourcedir/ destdir/
- File: mv sourcefile mydir/ Note that mv can be used to rename a file, if the source and destination are on the same directory, mv test test2. As with cp, mv has quite a few options. Also, note that you don't need the slash you could type mv sourcefile mydir
- Directory : mv sourcedir destdir Again, it can be used to rename directories too.
No comments:
Post a Comment