|
Hard Disk
PCI devices
System Calls
Logs
Directory Structure
redirection
- combine stderr with stdout: (cvs update -d 2>&1) | grep -v '^cvs update: Updating'
-
>> operator
- append redirection operator
- for example cat fileA >> fileB
- This will copy the contents of fileA and place them at the end of fileB
- useful commands
- send both stderr and stdout to file: command 1>/dev/null 2>&1
Using ls to only list directories:
- use ls -d */
- in the -d causes the command to list only the directory, not its contents
- the */ lists any file that ends in '/', which are directories
finding files
Recursive Touch
- find . -print0 | xargs -r0 touch
- find /home -exec touch {} \;
creating tar/zip file
- Example: tar -cvzf zipped_file_name.tar.gz files_and_or_dir
Shells
diff
cut
- cut -d'#' -f1-1 test - remove '#' comments from the test file
sed
- output only particular lines
- sed -e 'begin_line,end_line!d'
- one-liners
user accounts
- adding
- removing
- userdel user_to_delete
- -r can be used to also remove the user's home directory
- ref
patches
- creating
- diff -uprN file.orig file
- p - shows C function
users
- listing
- cat /etc/passwd | cut -d":" -f1
- add user to a group
- usermod -aG GROUP1[,GROUP2,...[,GROUPN]]] username
- remove a user
- userdel -r roger
- -r - remove home diretory also
Useful Links