Sep 24, 2008

Mac OS commands

Apple OS commands Link 1

Apple OS commands Link 2

1.showing all the process
top

2. to kill a process from top menu
kill processID

3.exit from an existing menu
q

4.clear screen
clear

5.killing a process from command promt
pkill -9 processname (kill dile kernel er kase request, but pkill -9 is force command)
pkill -SIGKILL processname(9 is the id of SIGKILL)

6a). list of every files in the current directory
ls filename

6b). list of files with the permission
ls -l filename

7.running a jar file form command prompt using the stack size and other sizes
java -jar Xms256m Xmx256m Xss64m ./jarname.jar

8. copy a folder from desktop to pendrive
cp -r /home/user12/Desktop/foldername /home/media/
-r stand for recursively copying all the files in the folder

9. unzip a zip file
unzip -x zipfilename.zip

10. adding environment variable
following to commands sets ARCHDIR and PATH environmental variables for nachos
export ARCHDIR=/home/mar343/mips-x86.linux-xgcc/mips-gcc
export PATH=/home/mar343/mips-x86.linux-xgcc/mips-gcc:$PATH

11. change permission of the file
chmod 644 profile
this will give the read/write permission to the user and read permission to group and other users

12. copy files from a remote host
scp aladin@uranus.cs.drexel.edu:/Users/aladin/data/a.png /Users/reza/Desktop/
It will prompt for password for the remote user name.
To do recursively add -r after scp.

// problem occurs when user do not have the permission on the disk to write.
// if the user still having an admin account, then create a directory with sudo
// command at the beginning. Then chmod the folder with 777. read/write/execute with
// sudo. Then write on the folder using sudo scp command.

13. renaming a folder
mv oldname newname


14. version of GCC.
g++ --version
or
gcc --version

15. compile C++ file using the specific gcc version
g++-verion for example
This command will compile a cpp file named test.cpp resulting in an object file named a.out

g++-4.2 -o a.out test.cpp

16. unzip a rar file
unrar e file.rar

17. see the value of an environment variable
echo $MAGICK_HOME

18. creating a directory
mkdir dir_name

19. making a symbolic link (not alias)
ln -s /Volumes/Macintosh\ HD/FolderName/ FolderNameAsLink
It will create a link name FolderNameAsLink. So when accessing
the folder using command prompt cd FolderNameAsLink, it will
go inside the /Volumes/Macintosh\ HD/FolderName/ folder.

20. remote login using ssh with X11 for display purpose.
ssh -X name@domain

21. disk space used+available
df -k or df -kh for human readability

22. du shows how much space one ore more files or current directories is using.
du -sh

23. multiple directory creation(used when i was compiling a java program)
mkdir -p src/test

24. show the hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
Then alt+click-on-the-Finder will show a refresh button. Clicking that will ensure that the hidden files are visible. Do the same command with FALSE to make invisible the hidden files.

25. Rich Socher's unix utils:
http://www.socher.org/index.php/Main/LinuxUnixCommands#ntoc5

26. X-server not displaying anything when I do
$ssh -x server
aparently the solution is to install XQuartz then everything works.
$echo $DISPLAY
$localhost:10.0 Reference

27.

28

29.

30.




No comments:

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...