sudo and a bash builtin command

commandline session

$ 4.2.36 37 537---> cd /var/log/gdm3/
bash: cd: /var/log/gdm3/: Permission denied
$ 4.2.36 38 538---> cd /var/log/gdm3/
bash: cd: /var/log/gdm3/: Permission denied
$ 4.2.36 39 539---> sudo sh -c 'cd /var/log/gdm3/'
$ 4.2.36 40 540---> sudo cd /var/log/gdm3
sudo: cd: command not found
$ 4.2.36 41 541---> sudo cd /var/log/gdm3
sudo: cd: command not found
$ 4.2.36 42 542---> sudo cd /var/log/gdm3
sudo: cd: command not found
$ 4.2.36 43 543---> sudo sh -c 'cd /var/log/gdm3/'
$ 4.2.36 44 544---> pwd
/home/jeffrin
$ 4.2.36 45 545---> sudo sh -c 'cd /var/log/gdm3/'
$ 4.2.36 46 546---> pwd
/home/jeffrin
$ 4.2.36 47 547---> sudo sh -c 'cd /var/log/gdm3/;pwd'
/var/log/gdm3
$ 4.2.36 48 548---> pwd
/home/jeffrin
$ 4.2.36 49 549---> sudo sh -c 'cd /var/log/gdm3/;du -h'
17M	.
$ 4.2.36 50 550--->

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s