Difference between revisions of "User:Scott/03"

From FreekiWiki
Jump to navigation Jump to search
Line 22: Line 22:
 
*sudo gedit xxxx &
 
*sudo gedit xxxx &
  
==File Attributes==
+
=File Attributes=
 
  ls -l  
 
  ls -l  
 
  d = directory
 
  d = directory
Line 37: Line 37:
 
  | = named pipe  
 
  | = named pipe  
  
==File Directory Tree==
+
=File Directory Tree=
 
  ls -Ra  [-R recursive] [-a all]  
 
  ls -Ra  [-R recursive] [-a all]  
 
  ls -ti  [-t sort by time] [-i inode]  
 
  ls -ti  [-t sort by time] [-i inode]  

Revision as of 23:07, 11 January 2012

  Directories & Files
--------------------------------
Home Page      user:scott
Tech Support   user:scott/02
Dir & Files    user:scott/03
Network        user:scott/04
Troubleshoot   user:scott/05
Laptops        user:scott/06
Resources      user:scott/07
Notes          user:scott/08 

Template:TOC limit

top

Useful Commands to Remember

history (!2054)

gksudo nautilus /home

gconf-editor (configuration)

run-process-in-background

  • sudo gedit xxxx &

File Attributes

ls -l 
d = directory
l = symbolic link
b or c = device block or char
n = named pipe
s = socket
ls –F 
@ = linked_file
* = executable_file 
/ = subdirectory
= socket
| = named pipe 

File Directory Tree

ls -Ra  [-R recursive] [-a all] 
ls -ti  [-t sort by time] [-i inode] 
ls -nr  [-n UID & GID] [-r reverse order]
ls -1F   [-1 line by line] [-F */=@|]

File Permissions

Change Owner & Group

chgrp
chown -R root:root folder-name
chown oem:oem file-name

Change Folder & File

chmod 774 folder-name (rwxrwxr--)
chmod 664 file-name   (rw-rw-r--)
chmod ugo+rwx /dir/file
chmod ugo-rwx /dir/file

Process (running & idle)

ps -l (bash)
ps -e [-e all processes] [-f full-listing] 

Directory Size

du -h   (-h human readable)
du -hc  (-c Directory Total Size)
sudo du -ch  (include .hidden files)
sudo du -ch --max-depth=1  /home/ (include /home/xxx)

Directory File Usage

du -h | less                 (-h human readable)
du -h /home/bob/Downloads/   (dir. in Download)
du -ha /home/bob/Downloads/  (files & dir. in Download)
du -ha /home/bob/Downloads/ | grep -i firefox   (find all instances of firefox and -i ignore case)

top

Search Locate Find

whereis [program]
which   [program]
sudo updatedb
locate /dir/dir | grep file
find -name filename ???

COPY MOVE

cp -vr Source ~/Destination  (-r pr -R recursively)	  	
mv -v  Source ~/Destination  (-r not necessary)
rm -rivf Desktop/ /home/dir [rmdir + content] [-i prompt] [-f force]

Symbolic Lnk

ln –s target linkname (symbolic link)

Difference between two files

diff file1 file2

.TAR & .ZIP

gzip file (zips) gunzip file (unzips)

tar -cvf NameOfArchive.tar file1 + dir1 + file2 (pack) [-c create] [-f ???] tar -xvf NameOfArchive.tar (unpack) [-x extract]

tar -czvf NameOfArchive.tar.gz  file1 + dir1 + file2 (pack & zip) tar -xzvf NameOfArchive.tar.gz (unpack & unzip)

whoami

finger (who is logged in)
id (uid=1000(sjnSUSE) gid=100(users) groups=100(users)
date & cal

top

echo $PATH

A list of directories your shell searches through when you enter a command
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games

MAN Pages

man –k whoami (look-up commands)
info whoami
help whoami